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

  

posted @ 2021-05-17 12:36  Areas  阅读(1450)  评论(0编辑  收藏  举报