繁体   English   中英

WebRequest在带有SSL的IIS8上不起作用

[英]Webrequest not working on IIS8 with SSL

发送请求及其调用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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM