You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am trying to implement accu weather api to my application.
When I added the service as Singleton, my requests after the first one always gets exception about disposed Socket. I changed .AddSingleton to .AddScoped and there is no problem now.
The problem with AddSingleton:
Cannot access a disposed object.
Object name: 'System.Net.Http.SocketsHttpHandler'.
at System.Net.Http.SocketsHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at Accuweather.Core.AccuweatherApiCore.SendGetRequest(String url)
at Accuweather.Locations.LocationsApi.GeoPositionSearch(Double lat, Double lon, Boolean details, Boolean topLevel)
I am not sure what should be done here but I think changing the documentation as AddScoped might be a good idea. Or am I missing something entirely else?
The text was updated successfully, but these errors were encountered:
Hi,
I am trying to implement accu weather api to my application.
When I added the service as Singleton, my requests after the first one always gets exception about disposed Socket. I changed .AddSingleton to .AddScoped and there is no problem now.
The problem with AddSingleton:
I am not sure what should be done here but I think changing the documentation as AddScoped might be a good idea. Or am I missing something entirely else?
The text was updated successfully, but these errors were encountered: