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

  

services.AddHttpClient

上一篇:.NET Worker Service 如何优雅退出


下一篇:基于AliOS的车载小程序