Search code examples
visual-studio-2015visual-studio-2017iis-express

"Unable to connect to web server 'IIS Express'"


.NET CORE 1.1 application, normally works and runs on localhost:5000. Sometimes I start getting the title error, and then I have to reboot my machine. I think I might have tracked it down somewhat to Docker now using port 5000. So I stopped docker figured that would be it. But I keep getting the same error. Resource monitor shows that port 5000 is in use by pid 4 'System'. I've killed the IIS processes and the port disappears. Then when I run my app again I keep getting the same error. I can restart VS (both 2015 and 2017) and use different ports, but I keep getting the error until I reboot.

Is there some way to recover from this without a reboot?


Solution

  • I was able to get it work doing the following:

    • Close Visual Studio
    • Delete the .vs directory in the solution folder
    • Restart Visual Studio
    • Change project to run on another port and debug it
    • Stop Debugging and change port back to 5000, then restart