Hi @Sandra Anderson,
I found this link, and I think the answer does a good job of explaining why *'System.Net.Http.SocketsHttpHandler' "Cannot access a disposed object"*
error occurs.
Could you change the code like below and tell us it works or not.
services.AddHttpClient("myHttpClient", client =>
{
client.BaseAddress = new Uri(uriPath);
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.Add(HeaderNames.Accept, "application/json");
})
.ConfigurePrimaryHttpMessageHandler(() =>
{
return new HttpClientHandler()
{
UseDefaultCredentials = true,
AllowAutoRedirect = false
};
});
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Jason Pan