c# - 请求被中止 : Could not create SSL/TLS secure channel but works from browser/POSTMAN

标签 c# .net ssl https

我有点迷路了。添加 ServicePointManager 东西通常可以解决此问题,但这次我不断收到以下错误。我的服务器可以从浏览器和 POSTMAN 访问相同的 URL。但是通过网站运行它失败了。不过,这适用于我的本地计算机。我在服务器上启用了 TLS 1.1 和 TLS 1.2。

我的服务器 TLS 设置有什么问题吗? https://www.ssllabs.com/ssltest/analyze.html?d=basketball.exposureevents.com

我使用的是 CertifyTheWeb 证书,基本上是免费的 SSL。不确定这是否与此有关。

我正在发送到下面的链接,当从 IIS 下面的代码发出请求时,该链接拒绝了请求。

https://www.nationalsportsid.com/tournament/6028

Message :The request was aborted: Could not create SSL/TLS secure channel. Source :System Stack Trace : at System.Net.HttpWebRequest.GetResponse() at

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;

var webRequest = (HttpWebRequest) WebRequest.Create("https://www.nationalsportsid.com/tournament/" + nationalSportsId);
try
{
    using (var webResponse = (HttpWebResponse) webRequest.GetResponse())
    {
        if (webResponse.StatusCode == HttpStatusCode.OK)
        {
            return true;
        }
    }
}
catch (WebException ex)
{
    Logger.Error(ex);
}

这是 Message Analyzer 记录的内容

握手

enter image description here

警报

enter image description here

最佳答案

这是 Apache 中另一台服务器上的配置问题。他们放松了他们的 SSL 配置,我不确定他们做了什么,但他们以前的配置如下。我现在可以向他们的服务器发出 HTTP 请求。

SSLEngine on

# Intermediate configuration, tweak to your needs
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE$
SSLHonorCipherOrder on
SSLCompression off

SSLOptions +StrictRequire

关于c# - 请求被中止 : Could not create SSL/TLS secure channel but works from browser/POSTMAN,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53638516/

相关文章:

C#:从txt文件中读取数据

.net - DB2 .NET提供者建议

c# - 使用 Shadow Copy 启动的 CefSharp 应用程序

sockets - Windows Phone 7.1 是否支持 SSL 套接字?

asp.net - 客户端身份验证 - 处理客户端证书

java - Spring Boot : RSA works, JKS 没有

c# - 在循环内运行时,随机数生成器总是选择相同的值

c# - 获取标记特定属性的所有属性

c# - string.IsNullOrEmpty(myString.Trim()) 与 string.IsNullOrWhiteSpace(myString)

c# - 表达式树可能不包含动态操作,但它没有告诉我在哪里