2

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?

2 Answers 2

4
  1. netsh http show sslcert. In the output search for entry for port 44300 and copy the certhash and appID values.

  2. Delete the entry for 44300: netsh http delete sslcert ipport=0.0.0.0:44300

  3. 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 
Sign up to request clarification or add additional context in comments.

5 Comments

I tried that, changed the cert to port 443 successfully (ran etsh http show sslcert to make sure port 443 shows up), then changed https binding to port 443. But when I open my web project in VS it forces the binding to change to 44300 again
Ok, i also opened the csproj file, changed the port there and now it seems to work ok
Great that you figured it out!
Fo anyone trying this, if you see "The parameter is incorrect" when adding certificate, instead type netsh then enter, then inside netsh enter remaining part of the command.
@Vitaly - the "Parameter is Incorrect" message is returned from Powershell, and simply indicates you need to wrap the parameters in single quotes; so netsh http add sslcert 'ipport=0.0.0.0:443'
0

Considering that you have mapped proper bindings. enable your application to use https in IIS by right click on webapplication virtual directory -> manage Application -> advance setting -> Enable Protocols

enter image description here

In FeaturedView pane click SSL Settings and check the box says Require SSL and click Apply.

enter image description here

You may also want to look at this existing post IIS Express defaulting to port 44300 for https when enabling SSL

2 Comments

Rahul - what you described is for IIS, not IIS Express
@Andrey, Ahh! I see that now. But can you not switch to IIS.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.