Monday, October 30, 2017

Visual Studio : Unable to connect to web server IIS Express

This is with VS 2017.

I was looking at a .NET Core project and wanted to change from http to https.

So under Properties / Debug, I checked the "Enable SSL" checkbox.

This changes the port so I then did a copy / replace of the old port to the new one and changed the URL to https e.g.

http://localhost:5000 became https://localhost:44326

Then I got "Unable to connect to web server IIS Express".

Consulted with Mr. Google.

The solution that worked for me was to:
  • Close the VS project
  • In File Explorer, navigate to the project and delete the entire ".vs" folder
  • Restart the project
  • Run as "Debug"
  • Works
Apparently, it has something to do with the "applicationhost.config" file.

 Enjoy!

1 comment:

Lex Li said...

Visual Studio 2017 latest (15.7 Preview 2) does work better in this scenario (as it would force update applicationhost.config in the background). Unfortunately they did it so late, and leave all users of previous versions behind.

More info about the error can be found in https://blog.lextudio.com/what-should-you-check-when-visual-studio-cannot-debug-asp-net-core-projects-4b5db8c5e129