I faced this problem several times and every time it had a different cause. Here are the causes and exact commands that worked for me.
Here are some causes:
Copy and pasting a certificate thumbprint from the Windows dialog adds a hidden character to your hash. It is not visible in text editors, but you need to remove the character to make it work.
An SSL thumbprint should be available in Personal → Certificates to work with localhost.
It should be 'ipport=', not 'ipport:'
SSL certificate should have a private key. If you are using the certificate management console, make sure that it has a little key icon on the certificate view.
The GUID should be defined in full format: {a10b0420-a21f-45de-a1f8-818b5001145a}, and it should have single quotes in PowerShell: '{a10b0420-a21f-45de-a1f8-818b5001145a}' Thus, the PowerShell format is different from the command line.
SSL certificate should have complete characters with all padding '0's and without any space. You may copy the thumbprint (be careful to remove special hidden characters) and remove spaces, or use 'netsh http show sslcert' to get the value if the certificate is already registered for another address.
What worked for me:
Here is the exact command that worked for me in PowerShell:
netsh http add sslcert ipport=0.0.0.0:20001 certhash=5304c034548b27c72b5e9c14f0c7bdd13e52d760 appid='{a10b0420-a21f-45de-a1f8-818b5001145a}'
And here is the command line statement:
netsh
http add sslcert ipport=0.0.0.0:20001 certhash=5304c034548b27c72b5e9c14f0c7bdd13e52d760 appid={a10b0420-a21f-45de-a1f8-818b5001145a}
More commands to help you avoid related problems:
Use the following command to see current registered certificate. You may find and reuse certhash or your appid from there:
netsh http show sslcert
If the certificate is already registered with similar ip and port, you need to remove it. I found it causes a problem with localhost, 127.0.0.1 and 0.0.0.0. You need to have only 0.0.0.0 registered in your testing environment. Use the following command to remove potential corrupted certificates:
netsh http delete sslcert ipport=0.0.0.0:20001