8

I changed my launch setting to support 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.

Ihen 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"
      }
    }
  }
}
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
raj
  • 143
  • 1
  • 1
  • 7
  • Mby check a port. If its no free can get error – J. Doe Dec 08 '16 at 13:21
  • I don't know exactly what's wrong in your situation, but another solution might be to use our free VS Extension called Conveyor -> https://visualstudiogallery.msdn.microsoft.com/a429dbb7-a982-4541-b401-934375c02c0f?redir=0 it allows connections to IIS Express from other machines/devices. – Jim W Jan 26 '17 at 18:00
  • @raj, did you ever find out the cause of this? I have asked a similar question here today: https://stackoverflow.com/questions/56890385/create-binding-causes-unable-to-connect-to-web-server-iis-express. Thanks. – w0051977 Jul 04 '19 at 15:19
  • for me it was port issue i changed the port issue in the applicationUrl launch settings.json and it worked – Rahul Sharma Oct 16 '19 at 08:49

8 Answers8

16

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.

Peter
  • 743
  • 5
  • 26
5

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
AlexDev
  • 4,049
  • 31
  • 36
2

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.

2

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.

kiyah
  • 1,502
  • 2
  • 18
  • 27
Alison Niu
  • 64
  • 3
1

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.

Jamshaid K.
  • 3,555
  • 1
  • 27
  • 42
0

I also encountered this issue recently (along with some others: VS 2019 does not open web app project in chrome if chrome is already open) and found out that I was running VS in administrator mode.

I resolved this by running VS and Chrome in normal mode.

Wajiha
  • 1
  • 1
0

my project version 2.2 enter image description here my computer version 5.0 (cmd: dotnet --list-sdks) enter image description here

I installed version 2.2 to my computer. I can run the application now.

0

I tried all suggested solutions but for me the only solution is to go cert store delete my dev certificate (localhost) and solved.