Visual studio 2017 "Unable to connect to web server 'IIS Express'"

I know there is already an accepted answer to this question, but none of the solutions worked for me and my solution may help someone. I am using VS2017 with an ASP.NET Core 2.0 Razor Pages project.

The error just started appearing for no obvious reason, and I tried the solutions posted here.

I ran the web app from the command line using the dotnet run command to see if that would bring up any meaningful errors, and there was a warning about the URL not being correctly bound. I looked in my projects Properties\launchSettings.json file and noticed that the applicationUrl properties were different.

enter image description here

  1. Change the values for applicationURL so they are the same
  2. Close the project and close VS
  3. Delete the hidden .vs folder (as mentioned in the accepted answer)
  4. Start up VS as Admin

Your app should work fine.


I was having the issue on Visual Studio 2019 with a clean branch from master. Restarting the PC solved the problem.

My college said he is having the problem about 2 times a month and other tries for solutions did not work.


I installed core 2.0 and updated VS 2017 to 15.4.3 today, had the same error.

I ended up changing the application to run on a different port, it worked for me.

I have tried to delete the vs folder but did not work.

Hope it helps.


I had this problem. There is a hidden folder in directory of project that name is '.vs'. Close the Visual Studio and delete this folder. The problem will be solved.