【问题标题】:ASP.NET, HttpWebRequest and "Could not create SSL/TLS secure channel"ASP.NET、HttpWebRequest 和“无法创建 SSL/TLS 安全通道”
【发布时间】:2014-12-18 22:34:57
【问题描述】:

是的,我知道 SO 和 google 上有很多类似的问题。是的,我已经阅读了所有内容并尝试了那里所说的一切。是的,任何解决方案都没有帮助我。

我有在 ASP.NET 应用程序上下文中使用的类库。我的类库从第三方 HTTPS 网站下载数据。该网站需要客户证书。我向LOCAL_MACHINE\MY 添加了证书,并在winhttpcertcfg 中授予了对它的访问权限。

我的LogIn 方法在存储中找到该证书。正如我在调试输出中看到的 - 在这个阶段一切都很好。但后来,当我尝试加载页面时,我得到了The request was aborted: Could not create SSL/TLS secure channel. 异常。

我的代码:

client = new XHttpClient();
X509Store store;
X509CertificateCollection certificates;
store = new X509Store(StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);
certificates = store.Certificates.Find(
    X509FindType.FindByIssuerName,
    "Xxxxxxxx Root CA", true);
// everything is fine here, certificates[0] is my certificate
client.ClientCertificates.AddRange(certificates);
store.Close();

有什么想法吗?

【问题讨论】:

    标签: c# asp.net ssl ssl-certificate system.net.httpwebrequest


    【解决方案1】:

    好的,伙计们。我自己找到了原因。感谢post,我发现 IIS 7.5 在 IIS_IUSRS 用户下运行,而不是我认为的 NetworkService。一旦我使用winhttpcertcfg 授予对证书的访问权限,它就开始工作了。

    【讨论】:

      猜你喜欢
      • 2018-06-17
      • 2023-04-08
      • 2021-02-27
      • 2016-06-30
      • 2017-12-10
      • 2020-09-23
      • 1970-01-01
      • 2021-12-13
      • 2014-12-26
      相关资源
      最近更新 更多