Additionally, I have not seen much documentation that includes the method encapsulated HttpClient configuration pattern whose DI setup looks like.
'''
services.AddHttpClient<IMyService, MyServiceImplementation>( configuration => ...)
'''
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Thanks for raising this issue @rcollette
I've added this to our backlog for the next update to this sample.
Any news on this Bill?
For those of us behind corporate firewalls it would be helpful to include a discussion about proxy handling including examples of setting up the WebProxy and HttpClientHandler classes needed.
For anybody who has trouble with proxy: This worked for me: Replace:
private static readonly HttpClient client = new HttpClient();
with
private static readonly HttpClientHandler handler = new HttpClientHandler
{
DefaultProxyCredentials = System.Net.CredentialCache.DefaultNetworkCredentials
};
private static readonly HttpClient client = new HttpClient(handler);
Most helpful comment
Any news on this Bill?