在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; }