wcf - 使用 SSL 和 WCF 自托管 - 无法将证书绑定(bind)到端口

标签 wcf ssl

我有一个 WCF 服务,我想使用 SSL 访问它。我在我的开发机器上,所以我在考虑自托管服务。我一直在关注 Configuring HTTP and HTTPS .

我创建了一个自签名证书,并将其添加到 Trusted Root Certification Authorities。我已经创建了另外两个由第一个签名的证书,一个用于客户端,另一个用于服务器。我关注了 Using makecert to create certificates for development .

我无法通过 SSL 证书配置步骤。当我使用 netsh 将证书绑定(bind)到端口号时它抛出一个 SSL 错误:

Certificate add failed, Error: 1312 A specified logon session does not exist. It may already have been terminated.

证书是否需要一些特殊字段或其他东西才能工作?

CA证书:

makecert -n "CN=TestCA" -cy authority -a sha1 -sv "TestCA.pvk" -r "TEST_CA.cer"

服务证书:

makecert -n "CN=rneapp.com" -ic "TEST_CA.cer"  -iv "TestCA.pvk" -a sha1 -sky exchange -pe -sv "rneapp.com.pvk" "rneapp.com.cer"

客户端证书:

makecert -n "CN=rneClient" -ic "TEST_CA.cer"  -iv "TestCA.pvk" -a sha1 -sky exchange -pe -sv "rneClient.pvk" "rneClient.cer"

我正在使用此命令将证书绑定(bind)到端口:

netsh http add sslcert ipport=0.0.0.0:8465 certhash=a853f3b5b48b8a506bdc4212ba2726a3bfea2bb6 appid={2E53B9B0-17AE-4EBC-A1AE-43D53A6FD07D} clientcertnegotiation=enable

最佳答案

当我遇到同样的问题时,将证书从当前用户移动到本地计算机存储会有所帮助,因此请尝试检查您的证书存储。

netsh http add sslcert 的内置帮助也提到了关于 certstorename 选项的这一点:

        certstorename           - Store name for the certificate. Defaults
                                  to MY. Certificate must be stored in the
                                  local machine context.

关于wcf - 使用 SSL 和 WCF 自托管 - 无法将证书绑定(bind)到端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6228003/

相关文章:

c# - App.config AppSettings 返回空

c++ - 如何在 C++ 中调用 Rest 服务?

c# - HMACSHA1 SSL 问题

java - 使用 Apache HttpClient 通过 SSL 身份验证发送 HTTP 请求

wcf - 缺少 .NET 3.5 Entity Framework 的某些内容?

c# - System.Configuration.ConfigurationException 在 Windows Server 2012 上运行基于 .NET 4.0 的服务构建时

visual-studio - 如何在Win7上使用VS2010测试SSL切换

Magento 在 Gmail 上配置电子邮件

rest - 如何在 C# UWP 应用程序中使用 ASP.NET Core Web API?

android - 您的浏览器发送了该服务器无法理解 HttpsURLConnection 的请求