问题
I know I am not the one who is losing a certificate association after computer restart. In particular:
- Open "Site Bindind" dialog in IIS
- Find my HTTPS binding
- Press "Edit..."
- From the "SSL certificate" I am selecting my certifivate
- Press Apply
Everything works just perfect, but until the computer restarts. After the restart when I open the Binding properties I see (Not selected)
what I have discovered that after
netsh http show sslcert
I cannot see my port I am using for HTTPS binding
when I am netsh http add sslcert ipport=0.0.0.0:port certhash= appid={ID}
everything works further
As sa fast but dirty solution I have created a bat file with the following content:
netsh http del sslcert ipport=0.0.0.0:port
netsh http add sslcert ipport=0.0.0.0:port certhash=<Hash> appid={ID}
and scheduled launch of the bat file in Windows Scheduler (At start up after 1 minutes) worked for some time, but now has stopped.
What is wrong at how to fix it?
回答1:
I just had a similar problem, where my SSL bindings for my self-hosted OWIN app were lost whenever I restarted the machine.
I came across this post: Adding SSL Certificate via "netsh.exe" does not last after a machine restart, which mentions:
I think by moving the self signed cert from Personal to Trusted Root CA directory causes a problem that SSL stops working after developers reboot their machines. (Don't know how it happens, but it does happen consistently.) I finally get around this issue by export and re-import the self-signed cert into the trusted root directory (instead of simply drag it over). Now my self-signed cert is considered and I don't need to REINSTALL/REPAIR IIS Express every time I reboot the machine.
My scenario was a bit different, but when I imported my localhost SSL cert, I was also using drag-n-drop to copy it from the Personal Certificates for "Current User" to the Personal Certificates for "Local Computer." So I deleted my cert and re-imported without using drag-n-drop, and that seems to have handled it - I can now reboot my machine without losing my SSL port bindings!
Hopefully this will work for you as well (if you are still having the issue).
来源:https://stackoverflow.com/questions/27564823/iis-loses-https-endpoitn-certificate-after-computer-restart