I have an MVC 5 web application parts of which I need to run using SSL (lie login, account management etc). I enabled SSL for the web project, changed bindings in applicationhost.config
:
<bindings>
<binding protocol="http" bindingInformation="*:80:example.com" />
<binding protocol="https" bindingInformation="*:443:example.com" />
</bindings>
But, when I restart IIS Express and run the site, it overwrites the SSL port to 44300. Any ideas to make it stay at 443?
netsh http show sslcert
. In the output search for entry for port 44300
and copy the certhash
and appID
values.
Delete the entry for 44300: netsh http delete sslcert ipport=0.0.0.0:44300
Add a new entry for port 443 with certhash and appID from step 1: netsh http add sslcert ipport=0.0.0.0:443 certhash=<certhash> appid=<appid>
.
If you're running this inside Powershell, you'll need to wrap the parameters in single quotes, so the command in step 3 above becomes netsh http add sslcert 'ipport=0.0.0.0:443' 'certhash=<certhash>' 'appid=<appid>'
After configuring the entry in http.sys, you need to restart http service for the changes to take effect.
net stop http
net start http
From Powershell, you can restart the service like this:
Restart-Service http