How does localhost get its ID number in asp.net?

Xarzu

Member
Joined
May 24, 2010
Messages
5
Programming Experience
Beginner
How does localhost get its ID number in asp.net?

I have a question about ASP.NET and running test web sites locally.
I have written two asp.net web sites for testing purposes. One works and the other one fails. The one that fails does not give any useful diagnostic information.

Can you tell me how these id?s are generated that are alongside the localhost: url?

localhost.PNG
 
They're not IDs. They are port numbers. The default port is 80 for web sites so the ":80" is implied in most URLs. You can specify the port number in the project properties. A random port number is used if you don't specify one yourself, but that random selection is only made once, so it's the same one every time.
 
Actually you can set these properties depending on if you are using a local development server or IIS within the Properties of your current Project by following the steps below :


Right-click on your Project within the Solution Explorer in Visual Studio.
Select the Web tab on the left-hand side.
You should find a section called Servers within the right-hand pane.
You should then see the following area that will allow you to either explicitly use a Specific Port or Auto-Assign Port :
1.png
localhost get its ID number in asp.net
 
It is randomly generated port number on which your development server is listening. Default port number for IIS is 80. However you can also set it manually if you like, method for this is given below :
[h=3]To specify a port for the Visual Studio Development Server in a Web Site Project :[/h] 1. Open Solution explorer and click on the name of the site.
2. In Properties pane, click on Use dynamic ports and select False from the drop-down list.
3. Now in the Properties pane, click the text box beside Port number and type in a port number.
4. Click outside of the Properties pane. This saves the property settings.

[h=3]To specify a port for the Visual Studio Development Server in a Web Application Project[/h] 1. Open Solution explorer and click on the name of the site.
2. In the Project menu, click Properties.
3. Click on the Web tab.
4. Click Specific port and enter a port number.
 
Back
Top