Why and how to fix? IIS Express “The specified por

2019-01-17 09:39发布

We know a random port number is assigned to a web application in Visual Studio. It works fine in my office desktop. But when I pull the code onto my laptop (from VisualStudio.com) and run the web app. I got a message, saying,

The specified port is in use

Port 10360 is already being used by another application.

Recommendations

  1. Try switching to port other than 10360 and higher than 1024.
  2. Stop the application that is using port 10360.

I can fix it using Recommendation #1 by changing the port into something else like 13333. But I am very curious what happened to port 10360. How can I check what application is using port 10360? How can I stop that application?

19条回答
爷、活的狠高调
2楼-- · 2019-01-17 09:56

Open your csproj with for example Notepad ++ and scroll down to DevelopmentServerPort. Change it to something else as long as it's above 1024 like rekommended (so for example 22312). Also change the IISUrl to http://localhost:22312/. Save your changes and restart the project.

查看更多
【Aperson】
3楼-- · 2019-01-17 09:57

For me, close all application and restart the computer.

When window start, Open Visual studio first, then open browser and click run(F5).

Now it works. I don't know why.

查看更多
霸刀☆藐视天下
4楼-- · 2019-01-17 09:57

For me netstat did the trick to show me that I had Fiddler running which was keeping the port open.

查看更多
不美不萌又怎样
5楼-- · 2019-01-17 10:01

This was haunting me for over a year!

For me,

  • no website was running iin IIS Express
  • nothing was using the port as determined by running: netstat -ano at the command line.

The solution was to run

netsh http add iplisten ipaddress=::

from the command line.

Happy days, and credit to: James Bryant! https://developercommunity.visualstudio.com/content/problem/110767/specified-port-is-in-use.html

查看更多
ゆ 、 Hurt°
6楼-- · 2019-01-17 10:01
  1. Delete the .sln file, if you have one.
  2. Open the file C:\Users\NN\Documents\IISExpress\config\applicationhost.config
  3. Locate the problematic site in configuration/system.applicationHost/sites and delete the whole site section.
  4. "Open Web Site.." from Visual Studio and the project will be given a random new port.
查看更多
可以哭但决不认输i
7楼-- · 2019-01-17 10:01

When Port xxxx is already being used, there's always a PID (Process Id) elaborated with the error. Simply go to the task manager on the machine you are running the application, click on details, and you will identify what the other application is. You can then decide whether you want to end that process or not

查看更多
登录 后发表回答