gpt4 book ai didi

c# - Webrequest 不适用于带 SSL 的 IIS8

转载 作者:太空宇宙 更新时间:2023-11-03 14:54:49 25 4
gpt4 key购买 nike

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

关于c# - Webrequest 不适用于带 SSL 的 IIS8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30680850/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com