.net 6 解决The SSL connection could not be established 电脑版发表于:2022/8/9 10:15 ```csharp var Bomurl = configuration["BomUrl"]; services .AddHttpClient<swaggerClient>("BOM", httpclient => httpclient.BaseAddress = new Uri(Bomurl)) .ConfigurePrimaryHttpMessageHandler(() => { var httpClientHandler = new HttpClientHandler(); // 忽略证书 httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; return httpClientHandler; }) .AddPolicyHandler(x=>HttpPolicyExtensions.HandleTransientHttpError().WaitAndRetryAsync(2, _ => TimeSpan.FromSeconds(1))) ; services.AddScoped(x => { return new DapperHelper(new SqlConnection(configuration.GetConnectionString("DBWorksConnection"))); }); ```