webservice接口调用时,抛出异常:“基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系“
解决方案:接口调用前先设置证书回调、和安全协议
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.SystemDefault | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;
版权归原作者 射白鹿 所有, 如有侵权,请联系我们删除。