43

When I access the site as http://localhost:26049, the site runs fine. If I try to access the site with https://localhost:44319, I get page not found.

This is my project properties:

project properties

This is from my IISExpress application config:

<site name="MVC Authentication" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="F:\Projects\MySite\Test" />
    </application>
    <bindings>
        <binding protocol="https" bindingInformation="*:44319:localhost" />
        <binding protocol="http" bindingInformation="*:26049:localhost" />
    </bindings>
</site>
garethb
  • 3,951
  • 6
  • 32
  • 52
  • 3
    this solution helps me - https://stackoverflow.com/questions/20036984/how-do-i-fix-a-missing-iis-express-ssl-certificate/20048613#20048613, – Sivalingaamorthy May 17 '16 at 06:25
  • Possible duplicate of [SSL Connection / Connection Reset with IISExpress](https://stackoverflow.com/questions/19417219/ssl-connection-connection-reset-with-iisexpress) – Morgan Thrapp Dec 20 '17 at 21:21
  • There is an SSL Diag tool for IIS Express https://docs.jexusmanager.com/tutorials/ssl-diagnostics.html which covers almost all the answers below. Run its report and the culprit can be obvious. – Lex Li Oct 22 '18 at 01:58

11 Answers11

105

Please, for the love of g*d, try this, before you get mired in some unnecessary craziness!

(Apparently IIS Express has reserved port range of 44300 - 44399 for simulating SSL)

Change to port 44300 (https://localhost:44300/)

DaniDev
  • 2,471
  • 2
  • 22
  • 29
38

Got solution from this post. Had to delete all localhost certificates and repair IIS Express. Thanks @ShaTin

https://stackoverflow.com/a/22818853/853295

Make sure to remove any previous 'localhost' certificates as those could conflict with the one generated by IIS Express. I had this same error (ERR_SSL_PROTOCOL_ERROR), and it took me many hours to finally figure it out after trying out many many "solutions". My mistake was that I had created my own 'localhost' certificate and there were two of them. I had to delete both and have IIS Express recreate it.

Here is how you can check for and remove 'localhost' certificate:

On Start, type -> mmc.exe, File -> Add/Remove Snap-in..., Select Certificates -> Add> -> Computer account -> Local computer, Check under Certificates > Personal > Certificates. Make sure the localhost certificate that exist has a friendly name "IIS Express Development Certificate". If not, delete it. Or if multiple, delete all. On Visual Studio, select project and under property tab, enable SSL=true. Save, Build and Run. IIS Express will generate a new 'localhost' certificate.

Note: If it doesn't work, try these: make sure to disable IIS Express on VS project and stopping all running app on it prior to removing 'localhost' certificate. Also, you can go to 'control panel > programs' and Repair IIS Express.

Community
  • 1
  • 1
garethb
  • 3,951
  • 6
  • 32
  • 52
  • I have multiple localhost certificates, I delete all and I reinstall iisexpress. And it works ;-) – Rodrigo Perez Burgues Apr 20 '17 at 11:06
  • Here is an explicit step by step guide of the same: https://www.pluralsight.com/guides/visual-studio-2017-resolving-ssl-tls-connections-problems-with-iis-express – Matty J Jul 28 '19 at 22:23
  • I recommend the above pluralsight article to reset the Certificates and local dev environment with IISExpress.... – Naveed Anwar May 24 '22 at 23:48
  • I have cleanup up all dev certificates and then reinstalled that did not work but repairing IIS express as per this article worked for me.. Thank you (y) – Umar Abbas Jul 13 '22 at 10:08
21

The steps followed by me to resolve this (I am using vs2015) enter image description here

1)Go to control panel

2)Add Remove Programs

3)Repair IIS Express

4)Restarted my computer

4)Next go to my documents->IIS Express->Config Files

5)Take a copy of them and Remove those files from there

6)Delete all items C:\Temp

7)Check for .vs folder in your sln file and goto config folder in it

8)Take a copy of that as well and remove the files inside it

9)Clean your solution

10)Restart Visual studio

11)Build and run

(I copied clean config files from my colleagues machine - in locations mentioned above
1]In Documents
2] .vs folder
I suppose Just running IISExpress and it will recreate the file for you. The exe is located at: "c:\Program Files\IIS Express\iisexpress.exe". )

Kush
  • 273
  • 2
  • 9
10

It looks like IIS Express is not starting the project under the https URL. Try changing the default project URL to the SSL one in

"Web Project->Properties->Web->Project URL" to the URL with https.

enter image description here

TejSoft
  • 3,213
  • 6
  • 34
  • 58
  • I updated this to my SSL URL, and now I'm getting an error saying: Your connection is not private Attackers might be trying to steal your information from localhost (for example, passwords, messages, or credit cards). NET::ERR_CERT_AUTHORITY_INVALID – Christine Apr 07 '16 at 19:03
  • @Hill Assuming you're running your own code locally on IIS, and haven't explicitly set your browser to accept your self-signed certificate, this is expected and nothing to worry about. Basically, the "Attacker" your browser is referring to is *you*. SSL is still doing it's thing, it's just warning you there might be a man in the middle attack going on. – cwharris Apr 22 '16 at 16:51
  • This solution worked for me as repairing IIS express didnt work. I think the advantage of the solution is that IIS express generates a virtual directory(if not already there) when you specify this option – S Raghav Sep 15 '17 at 04:28
8

In my case on a previous run the IIS Express added a certificate (called localhost) to the Personal > Certificates folder. But I was getting an invalid certificate error in the application. So I moved the localhost certificate to the Trusted Root...> Certificates and everything started to work.

The next day when I run the same application I started to get this ERR_CONNECTION_RESET error. All I had to do is to move the localhost certificate out of the Trusted Root...> Certificates folder and back to the Personal > Certificates folder. enter image description here

In case the "localhost" certificate is missing in either of the folders then you have to repair/reinstall IIS Express from Control Panel > Add/Remove Programs. This will reinstate the localhost certificate.

Visual Studio 2015, IIS Express, Windows 8, Asp.net MVC

Rahatur
  • 3,147
  • 3
  • 33
  • 49
1

I was having these SSL issues with Chrome and Edge.

After a long process of reviewing all these answers and suggestions, what eventually worked for me (asp.net mvc 5, VS2015) was a mix of the answers above

  1. Add Certificates snap in as shown above, removing mutlitple certs and regenerate a new certificat: Thanks @garethb
  2. The issue then is around the trust level of that certificate. The following link shows step by step process to export and then import (not just move) the local certificate https://blogs.msdn.microsoft.com/robert_mcmurray/2013/11/15/how-to-trust-the-iis-express-self-signed-certificate/

    1. When closing everything and then rebuild and deploy into IIS Express, I no longer have the SSL errors in any browser
Brennon
  • 21
  • 1
1

I had the same problem. My HTTP site was running fine, but IIS Express just wouldn't start my SSL site. While it did the day before.

My problem was that I had somehow messed up the aplicationhost.config file. My project was registered twice:

<site name="Test.Api" id="5">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\Users\bartd\Source\Repos\Test\Test.Api" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:27108:localhost" />
    </bindings>
</site>
<site name="Test.Api(1)" id="6">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
        <virtualDirectory path="/" physicalPath="C:\Users\bartd\Source\Repos\Test\Test.Api" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:27108:localhost" />
        <binding protocol="https" bindingInformation="*:44349:localhost" />
    </bindings>
</site>

Removing both entries and creating a new virtual directory from the project properties page fixed the problem for me.

Creating a new virtual directory from the properties page

Shiffty
  • 2,086
  • 2
  • 26
  • 31
bartd
  • 41
  • 5
0

None of these options worked for me in VS2017 with the same problem. This solution using iisexpresscmdadmin with a self-signed cert got my site to finally pull up:

How do I fix a missing IIS Express SSL Certificate?

John Ernest
  • 785
  • 1
  • 8
  • 20
0

Using VS 2017, none of these solutions seemed to work, even after exporting certificate and importing into Chrome. It finally worked after I did two things: (1) copied the localhost certificate from Personal to Trusted Root (2) changed the port number in project properties from 61899 to 44300 I think doing just step (2) did the trick.

Ross Kelly
  • 477
  • 1
  • 6
  • 23
0

Try changing bindings in IIS

This link is what solved my 3 day long intermittent headache: https://deanhume.com/set-up-iis-7-to-run-a-secure-site-locally-https/

Here are the specific steps that lead to my discovery of the real problem:

Windows key > Administrative tools > Internet Information Services > Click on Default Website (or whatever your website is) > Bindings... > Blow all the duplicate bindings away for local host > Add https binding for port 80.

Unheilig
  • 16,196
  • 193
  • 68
  • 98
djg
  • 131
  • 9
0

In my case just switching from Edge to Chrome fixed this instantly (VS 2019 Pro / Windows 10 latest)

A X
  • 905
  • 2
  • 13
  • 31