- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在向我托管的 https://网站发出简单的 GET 请求时,我不断收到间歇性 SecureChannelFailure 错误。没有错误进入服务器日志文件。每 100 次调用的频率小于 1 个错误,但下面的代码是否会导致这些错误?
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36";
request.ContentType = "application/x-www-form-urlencoded";
request.Accept = "text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, image/gif, */*;q=0.8, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, */*";
request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate,sdch");
request.Proxy = null;
request.AllowAutoRedirect = autoRedirect;
request.Headers.Add("Upgrade-Insecure-Requests", "1");
HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
request.CachePolicy = noCachePolicy;
HttpWebResponse response = (HttpWebResponse)request.GetResponse()
错误:
SecureChannelFailure
System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
更新:一直在 .net 创建的控制台应用程序中调用它。我无法使用在同一台 Windows 机器上运行的 python 脚本来复制相同的问题。那么与微软有关吗?
最佳答案
遇到了同样的问题,它也发生了大约 1% 的时间......
删除旧的安全协议(protocol)后效果更好,只保留 TLS 1.2
试试看:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
关于c# - 间歇性 SecureChannelFailure 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49049843/
在向我托管的 https://网站发出简单的 GET 请求时,我不断收到间歇性 SecureChannelFailure 错误。没有错误进入服务器日志文件。每 100 次调用的频率小于 1 个错误,但
我正在尝试访问 https://geocoder.cit.api.here.com在单声道上使用 .NET (F#)。我正在使用 FSharp.Data 中的 Http 帮助器,代码如下: let b
我用这个: WebClient mClient = new WebClient(); mClient.UseDefaultCredentials = false;
我正在使用 Visual Studio (C#) 创建 Xamarin.Droid 应用。 我有一个 RESTful 网络服务 (WebAPI),我想使用 HttpWebRequest 从中检索 Xa
我是一名优秀的程序员,十分优秀!