0

I know that this problem has been discussed here a lot of times before but believe me I've tried every single one of them and I still have this issue.

As a last resort before pulling my hair I decided to ask the question again and explain what I have tried so far:

  1. The first thing I have tried is to to remove .vs folder from the project as I read about it somewhere here.
  2. I have deleted the .vs folder started Visual Studio as administrator and changed the port number.
  3. I deleted IISExpress folder from [Documents]/IISExpress
  4. At this point I was pretty pissed off so I uninstalled and reinstalled Visual Studio 2017 Enterprise.
  5. I uninstalled and reinstalled IISExpress 10
  6. I uninstalled IISExpress 10 and installed IISExpress 8
  7. I put 127.0.0.1 localhost to my host file (It was not there before)

Nothing here did solved my problem so at this point I am pretty desperate and open to any kind of suggestions.

I am using Windows 10 with Visual Studio 2017 and cannot run any of the projects neither debug nor without debug mode. I am getting the same error all the time - Unable to connect to web server.

Any help is appreciated. Thank you in advance.

Hasan Hasanov
  • 1,129
  • 2
  • 15
  • 23
  • How long has the issue been going on? Any recent Windows updates that might account for the behavior? Any chance it's TLS/SSL-related (I haven't done any web development, so forgive my ignorance). – Gregg L Mar 30 '18 at 14:50
  • I haven't had any updates recently. The problem started two hours ago. Can you be more specific about TLS/SSL errors? – Hasan Hasanov Mar 30 '18 at 14:53
  • Post what VS Diag reports. Otherwise, readers of this question don't even know what are the settings on your machine. We have no magic to guess remotely. https://www.jexusmanager.com/en/latest/tutorials/vs-diagnostics.html – Lex Li Mar 30 '18 at 15:42

1 Answers1

1
  1. Clean and Rebuild Projects dependencies
  2. Clean and Rebuild the primary project
  3. Verify launchsettings and project build properties
  4. Close VS
  5. Clear bin and obj folders from project
  6. Go to C:\Users\username\Documents\IISExpress\config and delete all files from this folder
  7. Remove the .VS folder from the solution directory
  8. Verify the launchsettings.json has the correct format/syntax. You must have this applicationUrl listed in correct location like below:

Also you can use netstat to see all the ports in use; be aware that you must look at all IIS Express ports you use, and all local IIS ports.

Understanding that IIS will listen on one port, and reverse proxy to another port where the Kestrel server is listening.

{
  "IIS Express": {
    "commandName": "IISExpress",
    "launchBrowser": true,
    "launchUrl": "api/values",
    "environmentVariables": {
      “ASPNETCORE_ENVIRONMENT": "Development"
    },
    "applicationUrl": "http://localhost:44316/"
  }
}
  1. Restart Visual Studio, ensuring that you are running as Administrator
  2. Clean and Rebuild Projects dependencies
  3. Clean and Rebuild the primary project
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77