Search code examples
asp.netiissslhttpsiis-express

IIS Express http/https bindings not working correctly


I have a solution with 6 projects in it. And for 2 of them I enabled SSL in project properties. The problem is, that when I start debugging, all my projects starts with https, even if they're not configured to use SSL.

E.g. before enabling SSL my project was accessible via http://localhost:63684/. Now, with https enabled I can access my project under https://localhost:43000/, but when I try to access this url: http://localhost:63684/, it automatically changes to https://localhost:63684/ and I get the following error in the browser:

SSL connection error

ERR_SSL_PROTOCOL_ERROR

Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have.

The same goes for the projects, which doesn't have SSL enabled and I can't access them.

...\Documents\IISExpress\config\applicationhost.config file has proper bindings:

<bindings>
    <binding protocol="http" bindingInformation="*:63684:localhost" />
    <binding protocol="https" bindingInformation="*:44300:localhost" />
</bindings>

And other 4 projects, which doesn't have SSL enabled, but are still automatically switched to https:

<bindings>
    <binding protocol="http" bindingInformation="*:11483:localhost" />
</bindings>

I already tried to delete IISExpress folder, because I thought config is broken somehow, but it didn't help.

Any ideas what causes automatically switching to https and how to fix it?

BTW, I was following this article when implementing https in my 2 projects and my goal is to be able to use http when debugging locally and https when project is published to the web.


Solution

  • Turns out, that it was a Chrome problem, because I noticed, that on other browsers everything is working well. This SO answer helped me to fix this issue.