我有一个HTTPS URL来下载zip文件,但我需要从站点安装证书。我已将它安装在我的机器上。
这是我的代码:
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
//RemoteCertificateValidationCallback ServerCertificateValidationCallback = delegate { return true; };
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
using (WebClient wc = new WebClient())
{
wc.DownloadFile("https://markets.midwestiso.org/MISO/getSettlementStatementFile?entity=CORP_SUB3&nodeId=key0", @"C:\files\1.zip");
}
但是我收到以下错误消息:
请求已中止:无法创建SSL / TLS安全通道。
请帮忙。我无法找到解决方案。