解决因为https 安全请求导致的 安全连接失败问题
放在请求方法前面:
ServicePointManager.ServerCertificateValidationCallback = Callback;//需要配一个方法
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
/// <summary> /// 针对https 域名 /// </summary> /// <param name="sender"></param> /// <param name="certificate"></param> /// <param name="chain"></param> /// <param name="sslPolicyErrors"></param> /// <returns></returns> private static bool Callback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; }