raj
raj

Reputation: 143

Unable to connect webserver 'IIS Express'

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"
      }
    }
  }
}

Upvotes: 8

Views: 13667

Answers (8)

aydoğdu demirci
aydoğdu demirci

Reputation: 13

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

Upvotes: 0

AlexDev
AlexDev

Reputation: 4727

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

Upvotes: 5

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.

Upvotes: 0

Alison Niu
Alison Niu

Reputation: 74

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.

Upvotes: 2

vJ- tHe tiMe bOmB
vJ- tHe tiMe bOmB

Reputation: 61

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.

Upvotes: 2

Peter
Peter

Reputation: 781

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.

Upvotes: 16

Jamshaid K.
Jamshaid K.

Reputation: 4587

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.

Upvotes: 1

Wajiha
Wajiha

Reputation: 1

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.

Upvotes: 0

Related Questions