解决https调用出现【基础连接已经关闭: 未能为 SSL/TLS 安全通道建立信任关系】错误
在HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);前面添加
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult);
CheckValidationResult方法
public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { // 总是接受 return true; }