在下载代码之前加入如下代码:
// 解决WebClient不能通过https下载内容问题 System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) { return true; // **** Always accept };
上述代码主要是为了跳过https的ssl验证。
参考文章: