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
{{ message }}
Repository navigation
Needs updating to include .NET Core 2.1 HttpClientFactory #7489
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.
ID: 3bfcc1a8-ddda-810c-17b0-56a506045d67
Version Independent ID: 5415878b-e60b-5433-7b4b-efc8259908f0
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);
Activity
BillWagner commentedon Sep 13, 2018
Thanks for raising this issue @rcollette
I've added this to our backlog for the next update to this sample.
garfbradaz commentedon Oct 17, 2018
Any news on this Bill?
wadebee commentedon Apr 18, 2019
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.
cornel001 commentedon Feb 10, 2020
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);
dotnet-bot commentedon Jan 25, 2021
rcollette commentedon Jan 25, 2021
@dotnet/docs - This issue was not addressed and I still believe it is an important feature to document.
scottaddie commentedon Jan 25, 2021
@rcollette Have you already read the following doc?
https://docs.microsoft.com/aspnet/core/fundamentals/http-requests
The doc contains some examples of calls to
AddHttpClient. We can expand upon the examples in this doc, if needed.rcollette commentedon Jan 25, 2021
Yeah that suffices @scottaddie. Thank you for responding.
BillWagner commentedon Jan 25, 2021
Thanks @scottaddie.
@rcollette We'll leave this closed, as addressed.