Flurl.Http出现Call failed. The SSL connection could not be established 错误

用了SKIT的组件做企业微信开发,本地测试正常,上传服务器后出现One or more errors occurred. (The SSL connection could not be established, see inner exception.)错误

解决办法,修改Flurl默认的httpclient

public class UntrustedCertClientFactory : DefaultHttpClientFactory
    {
        public override HttpMessageHandler CreateMessageHandler() {
            return new HttpClientHandler {
                ServerCertificateCustomValidationCallback = (a, b, c, d) => true
            };
        }
    }


FlurlHttp.Configure(settings => {
    settings.HttpClientFactory = new UntrustedCertClientFactory();
});

参考:

c# - Flurl and untrusted certificates - Stack Overflow

Configuration - Flurl

你可能感兴趣的:(asp.net,core,http,ssl,flurl)