在为IIS7 +安装pipe理服务时,将创build并分配自签名SSL证书,其名称为“WMSvc-ComputerName”。
在GUI版本中,我可以将其更改为安装在服务器上的不同“正确”证书,以便远程客户端信任它。
pipe理服务的GUI模块在远程连接到服务器时不可用。
所以我需要使用服务器本身的命令行来改变它。 我该怎么做呢?
PowerShell解决scheme :(感谢Mathias R. Jessen)
# get the thumbprint for the certificate we want to use: $thumb = (Get-ChildItem cert:\LocalMachine\MY | where-object { $_.FriendlyName -eq "www.stackoverflow.com" } | Select-Object -First 1).Thumbprint # get a new guid: $guid = [guid]::NewGuid() # remove the self-signed certificate: & netsh http delete sslcert ipport=0.0.0.0:8172 # add the 'proper' certificate: & netsh http add sslcert ipport=0.0.0.0:8172 certhash=$thumb appid=`{$guid`}
使用certutil导入证书:
certutil -importpfx [Path to certificate file]
使用appcmd将HTTPS绑定添加到网站:
appcmd set site "Default Web Site" /+bindings.[protocol='https',bindingInformation='*:443:']
使用netsh将SSL证书添加到端点:
netsh http add sslcert ipport=0.0.0.0:443 certhash=[thumbprint of certificate] appid={[random GUID]}