Add-NetIPHttpsCertBinding给Windows系统错误1312

时间:2018-11-26 04:49:01

标签: powershell https certificate

我正在尝试使用Powershell设置https服务器。但是在Add-NetIPHttpsCertBinding上出现了1312错误。

这就是我生成证书的方式

openssl genrsa -des3 -out server.key 2048 # RSA Private Key
openssl req -new -key server.key -out server.csr 
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt 
openssl pkcs12 -export -inkey server.key -in server.crt -out server.pfx 

然后使用import-pfxcertificate导入

$mypwd= ConvertTo-SecureString -String "********" -Force -AsPlainText
Import-PfxCertificate -FilePath $mypath\server.pfx Cert:\CurrentUser\MyPassword $mypwd

然后将证书绑定到端口

Add-NetIPHttpsCertBinding -IpPort "127.0.0.1:443" -CertificateHash "806ADBC1A866167765450EB5735C86F7AD35327C" -CertificateStoreName Cert:\CurrentUser\My -ApplicationId "{3ccf7768-e7d7-4b7f-af0c-f0ce698ef083}" -NullEncryption $false

然后我得到一个指定的登录会话不存在。它可能已经终止了。它是Windows系统错误1312 Screenshot

非常感谢有人能帮忙。

0 个答案:

没有答案