The underlying connection was closed: A connection that was expected to be kept alive was closed by the server


#1

hi guys,

Please help me how to slove the “The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.” Issue. i’m using C# SDK to delete multiple users (using get users foreach).
after some of records delete. i’m getting “The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.” error. how to solve this issue plz help me

Mycode:
try
{
List lstUsers = oktaClient.GetUsersClient().GetList(null, 5000).Results.AsEnumerable().ToList();

            foreach (User user in lstUsers)
            {
				string userId = user.Id;
                var usersClient = oktaClient.GetUsersClient();
                var CurrentUser = usersClient.Get(userId);
                usersClient.Deactivate(CurrentUser);
                usersClient.Delete(CurrentUser);
			  }

}
catch (OktaException ex)
{
throw ex;
}


#2

I have same issue, do you have solution ?