绑定到端口时,SSL证书添加失败 [英] SSL Certificate add failed when binding to port

查看:1324
本文介绍了绑定到端口时,SSL证书添加失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用WCF创建了一个WebService。我正在进行自托管,我想启用HTTPS。根据我对此的理解,我需要创建一个证书并绑定到我想要使用的端口。

I created a WebService using WCF. I'm doing self hosting and I want to enable HTTPS. From my understanding for this to happen, I need to create a certificate and bind to the port that I want to use.

以下是我为解决此问题所采取的措施:

Here are the steps that I've done to handle this:


  1. 在我的本地计算机上创建一个证书作为根证书颁发机构

    • makecert -nCN =我的根证书颁发机构-r -sv RootCATest.pvk RootCATest.cer


  • makecert -sk MyKeyName -iv RootCATest.pvk -nCN = MyMachineName-ic RootCATest.cer -sr localmachine -ss my -sky exchange -pe MyMachineName.cer

从签名的根证书颁发机构创建临时服务证书

Created a temporary service certificate from the signed Root Certificate Authority


  • makecert -sk MyKeyName -iv RootCATest.pvk -nCN = MyMachineName-ic RootCATest.cer -sr localmachine -ss my -sky exchange -pe MyMachineName.cer

试图将证书绑定到端口号(在这种情况下为443)

Tried to Bind the Certificate to the Port number (443 in this case)


  • netsh http add sslcert ipport = 0.0.0.0:443 certhash = 2c5ba85bcbca412a74fece02878a44b285c63981 appid = {646937c0-1042-4e81-a3b6-47d678d68ba9}

步骤4的结果是以下错误:

The result from step 4 is the following error:


SSL证书添加失败,错误1312

SSL Certificate add failed, Error 1312

指定的登录会话不存在。它可能已经被终止。

A specified logon session does not exist. It may already have been terminated.

有没有人知道为什么我会收到这个错误?

Does anyone have a clue why I might be getting this error?

推荐答案

我遇到了同样的错误。第一次发生时,正如Micheal所说,我必须将证书移到证书(本地计算机) - >个人 - >证书文件夹下。当我在另一台机器上导入相同的证书时,我遇到了同样的错误。原因是我使用certmgr.msc导入证书。 。因此打开的窗口显示证书 - 当前用户。使用此窗口导入的证书会导致netsh因1312错误而失败。确保在MMC中使用证书管理单元来导入证书。 MMC的证书管理单元显示证书(本地计算机)。这让netsh执行成功。

I had the same error. The first time it occurred, as Micheal said, I had to move the certificate under Certificates(Local Computer) -->Personal -->Certificate folder. I had the same error when I imported the same certificate on another machine. The reason was that I was using certmgr.msc to import the certificate. . The window opened thus shows "Certificates – Current User". Certificates imported using this window cause netsh to fail with the 1312 error. Make sure to use certificate snap-in in MMC to import certificates. The certificate snap-in from MMC shows "Certificates (Local Computer)". This lets the netsh execution sail through.

这篇关于绑定到端口时,SSL证书添加失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆