Asp.net core - Unable to connect webserver 'IIS Express'

11,116

Solution 1

If you see something like this in the output console:

IIS Express starting...
iis express Failed to register URL "http://localhost:61367/" for site application "/". 
Error description: The process cannot access the file because it is being used by 
another process

The error is due to the port you are using.

Open a console and check out used port ranges with this command:

netsh interface ipv4 show excludedportrange protocol=tcp

It will look like this:

enter image description here

Change the port number you wanna use, which is outside of those ranges.

Solution 2

This problem is similar to https://stackoverflow.com/a/67990888/733760 and could be related to Hyper-v reserving a bunch of port ranges.

If that's the problem, the same answer applies (and worked for me). Run as admin:

net stop winnat
net start winnat

Solution 3

In my case, I unchecked "Enable SSL" in debug from project properties and ran the project. It made an iis pop up to appear which said the port is being used by chrome. So I closed all instances of chrome and switched again to "Enable SSL" and it fixed my issue.

Solution 4

The same thing happened but I don't know the reason, I restarted IIs and VS which didn't work. Then I restarted the computer, it is all fixed.

Solution 5

In my case, I had modified the project url in the debug mode, and after that it failed to run, I had to restart my Visual Studio in order to get it working.

Share:
11,116
raj
Author by

raj

Updated on June 18, 2022

Comments

  • raj
    raj almost 2 years

    i changed my launch setting to suppport remote ip hosting

    {
      "iisSettings": {
        "windowsAuthentication": false,
        "anonymousAuthentication": true,
        "iisExpress": {
          "applicationUrl": "http://192.168.1.69:55446/",
          "sslPort": 0
        }
      },
      "profiles": {
        "IIS Express": {
          "commandName": "IISExpress",
          "launchBrowser": true,
          "environmentVariables": {
            "ASPNETCORE_ENVIRONMENT": "Development"
          }
        },
        "myapplication": {
          "commandName": "Project",
          "launchBrowser": true,
          "launchUrl": "http://localhost:5000",
          "environmentVariables": {
            "ASPNETCORE_ENVIRONMENT": "Development"
          }
        }
      }
    }
    

    it works well in my system.

    then i download my project from tfs in another remote system and changed the ipaddress to support remote ip hosting and run the application in adminstrator mode..but still it showing "Unable to connect webserver 'IIS Express'"

     {
      "iisSettings": {
        "windowsAuthentication": false,
        "anonymousAuthentication": true,
        "iisExpress": {
          "applicationUrl": "http://192.168.1.79:55446/",
          "sslPort": 0
        }
      },
      "profiles": {
        "IIS Express": {
          "commandName": "IISExpress",
          "launchBrowser": true,
          "environmentVariables": {
            "ASPNETCORE_ENVIRONMENT": "Development"
          }
        },
        "eBMSForumApplication": {
          "commandName": "Project",
          "launchBrowser": true,
          "launchUrl": "http://localhost:5000",
          "environmentVariables": {
            "ASPNETCORE_ENVIRONMENT": "Development"
          }
        }
      }
    }
    
  • shammelburg
    shammelburg over 2 years
    Make sure to exit IIS Express in the command tray and then run the above command.