Visual studio 2019 “Unable to connect to web server 'IIS Express'”

12,262

Solution 1

I tried this one and it worked for me:

  1. Go to 'Debug Properties'

  2. Find 'Web Server Settings'

  3. Change the port in 'App URL' section and save the changes

  4. Run the application and the same error will appear again

  5. Switch the port back to the original port and save the changes

  6. Run the application and enjoy it!

I hope this trick work for you.

Solution 2

1- Go to 'Debug Properties', Find 'Web Server Settings', Change the port in 'App URL' section and save the changes

In your project folder, delete .vs file, also remove the launch settings file in properties (make sure you copy to a different folder before removing it).

Restart visual studio and your machine if possible. Go to launch setting, check if they are properly configured similar to your prev launch settings. Run the application in IIS.

Should start working.

Solution 3

The following fixed the problem for me.

Solution 4

From my experience this issue appears when the port used is already in use by other process. You will see the following:
Error description: The process cannot access the file because it is being used by another process. (0x80070020)
Just choose a port number which is free to use and the problem will disappear!

Solution 5

I encountered the same issue , but after few seconds i find out that there is a duplicated sslport , the same sslport being registered for another running app , so when i run another app with the same setting i see this error , you have to change the sslport in the launchsetting.json look the picture below

Share:
12,262
Mohammad Reza Nouri
Author by

Mohammad Reza Nouri

Updated on June 15, 2022

Comments

  • Mohammad Reza Nouri
    Mohammad Reza Nouri almost 2 years

    I attempt to lunch my ASP.NET Core project in Microsoft Visual Studio 2019 and got this error: "Unable to connect to web server 'IIS Express'"

    • Visual Studio 2019 Version 16.9.5
    • .Net 5.0