Webrequest不能在IIS8上使用SSL
本文关键字:SSL IIS8 不能 Webrequest | 更新日期: 2023-09-27 17:54:11
发送请求及其调用https的代码
request =(HttpWebRequest) WebRequest.Create(url);
request.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications);
request.Timeout = 5000;
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36";
request.ProtocolVersion = HttpVersion.Version11;
public bool AcceptAllCertifications(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certification, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
{
return true;
}
这段代码在我的本地系统上运行良好,但是当我们在IIS上部署它时,它就不能发送请求了
问题已解决,问题在服务器上。更新IIS主机文件注释不必要的IP