The “netsh” command can be useful in some WCF self hosting scenarios. I have previously shown how it can configure certificates for ssl.
For example this command will bind a certificate identified by the given hash on the 8732 local port.$> netsh http add sslcert ipport=0.0.0.0:8732 certhash=4f35f9386692f45b6cc35b7e786c9f06625b9567 appid={00112233-4455-6677-8899-AABBCCDDEEFF}
You may encounter this error when runing the command:
SSL Certificate add failed, Error: 1312 A specified logon session does not exist. It may already have been terminated.
Solution: This can mean that the certificate referenced by the hash does not have a private key. You may also want to verify that the private key has enough permissions.
Another famous error is:
SSL Certificate add failed, Error: 183 Cannot create a file when that file already exists.
Solution: This will happen if you try to bind the certificate to a port which is already binded to this or another certificate. If you want you can delete the existing binding:
$> netsh http delete sslcert ipport:1.1.1.1:8732