Docs: Needs updating to include .NET Core 2.1 HttpClientFactory

Created on 4 Sep 2018  Â·  4Comments  Â·  Source: dotnet/docs

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 => ...)
'''


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Area - C# Guide Technology - C# Fundamentals P1 Pri2 doc-enhancement dotnet-csharprod

Most helpful comment

Any news on this Bill?

All 4 comments

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);

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ygoe picture ygoe  Â·  3Comments

sebagomez picture sebagomez  Â·  3Comments

sime3000 picture sime3000  Â·  3Comments

LJ9999 picture LJ9999  Â·  3Comments

mekomlusa picture mekomlusa  Â·  3Comments