https://blog.csdn.net/soarheaven/article/details/79036333
https://www.cnblogs.com/ianunspace/p/5508179.html
//解決方法:
//引入命名空間:
using System.Security.Cryptography.X509Certificates;
using System.Net.Security;
//定義方法:
private static bool RemoteCertificateValidate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
{
//爲了通過證書驗證,總是返回true
return true;
}
//調用方法一:
//在構造函數中調用:
static WxRequest()
{
// 獲取驗證證書的回調函數
ServicePointManager.ServerCertificateValidationCallback+=RemoteCertificateValidate;
}
//方法二:
//在WebRequest請求之前調用:
ServicePointManager.ServerCertificateValidationCallback+=RemoteCertificateValidate;