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;