Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add a HttpClientHandler to a HTTP Client Factory configuration
private ServiceProvider ConfigureServices()
var services = new ServiceCollection();
services.AddLogging(builder =>
builder.AddFilter((category, level) => true);
builder.AddConsole(options => options.IncludeScopes = true);
services.AddHttpClient("cni", client =>
client.BaseAddress = new Uri("");
}).ConfigureHttpMessageHandlerBuilder(config => new HttpClientHandler
AutomaticDecompression = DecompressionMethods.GZip
return services.BuildServiceProvider();
Copy link

wangengzheng commented Oct 23, 2018


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment