services.AddHttpClient

 

public void AddInsuranceHttp(IServiceCollection services)
{
services.AddHttpClient("INSURANCE", option =>
{
option.Timeout = new TimeSpan(0, 0, 60);

}).ConfigurePrimaryHttpMessageHandler(() =>
{
return new HttpClientHandler()
{
MaxRequestContentBufferSize = 102400 ,
AutomaticDecompression = DecompressionMethods.GZip ,
ServerCertificateCustomValidationCallback = (message, cert, chain, error) => true
};
});
}

  

上一篇:Using Chat Services


下一篇:重新整理 .net core 实践篇————依赖注入应用之生命法则[三]