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
- Try switching to port other than 10360 and higher than 1024.
- 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?
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.
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.
For me netstat did the trick to show me that I had Fiddler running which was keeping the port open.
This was haunting me for over a year!
For me,
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
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