Search code examples
c#asp.netiis

ERR_CONNECTION_RESET when trying to access localhost on ASP.NET Web App project


So I've been working on this webapp project in my desktop computer, but I had to transfer it to my laptop since I have gone on holiday. The code builds fine, but when I try to access the site (http://localhost:port) in Chrome I get an ERR_CONNECTION_RESET message. I've also tried with other browsers (Firefox, Microsoft Edge, Opera) and I get a similar message. I also created a New Project and tried to run it with the same result. IIS Express seems to run without problems. I tried running netstat -ao in the cmd to see if the port assigned to the URL was being used by something else. And it was being actually used by a process with the PID:4, which turned out to be NT Kernel & System.

Things I've tried:

  • Self signing a certificate.
  • Writing 127.0.0.1 in the URL instead of localhost
  • Reinstalling IIS
  • Deleting the config files to make IIS create new ones
  • Modifying the <binding protocol="http" bindingInformation="*:port:localhost"/> removing the localhost part, leaving it like this: <binding protocol="http" bindingInformation="*:port:" />
  • Changing the port in Project Properties => Web, doesn't matter which one I pick, PID:4 always uses it.
  • Opening RegEdit and setting HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP's start attribute from 3 to 4, presumably stopping HTTP from listening to ports. Once I did this and rebooted the PC, I tried to run the dummy project again (the one which was only the template), and this time I got an unable to launch the iis express web server. I tried to work around it by reinstalling IIS and modifying the config, but it didn't work. At last, I decided to leave the 'start' attribute with value 3, and return to the ERR_CONNECTION_RESET since I wasn't sure it had been a step forwards or backwards.

Solution

  • It sounds to me like you might not have the right IIS settings installed. Take a look in your windows features. Make sure you have support for the right version on ASP.NET turned on

    Here are the settings I'm currently using for example