用了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();
});
参考: