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,
Port 10360 is already being used by another application.
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?
If you are running the Development Application Server, changing the port used by the server is the easiest solution. Change the Server Port in the Application Server Control Panel and start the server. Specify a port that is not 80, such as 8080. Changing the port number may not desired in a Production environment.
In Solution Explorer, right-click the name of the application and then select Properties. Click the Web tab. In the Servers section, under Use Local IIS Web server, in the Project URL box change the port number. To the right of the Project URL box, click Create Virtual Directory, and then click OK.
By default, you can use IIS Express to run your website using a non-reserved port such as 8080. However, using a reserved port such as 80 or 443 requires work. The steps described below assume you want to support local traffic over port 80.
I had a similar issue running Visual Studio 2019 on Windows 10. Some solutions that worked for others seemed to include:
Unfortunately, none of these solutions worked for me, assigning another port number did work but was not an acceptable solution as it was important for my application to run on a specified port.
The Solution
First I ran the command:
netsh http add iplisten ipaddress=::
from an elevated command-line process. This solved the initial error, when attempting to run the application I no longer got the "port in use" error, instead, I now got an error stating the application was unable to bind to the port because administrative privileges were required. (although I was running Visual Studio as administrator)
The second error was caused by Hyper-V that adds ports to the Port Exclusion Range, the port my application uses was in one of these exclusion ranges. You can view these ports by running the following command: netsh interface ipv4 show excludedportrange protocol=tcp
To solve this second error:
netsh int ipv4 add excludedportrange protocol=tcp startport=50403 numberofports=1 store=persistent
From here everything worked perfectly.
i solve the problem this way...
File -> Open -> Web Site...
After that select Local IIS under IIS Express Site remove the unwanted project.
hope this help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With