How to: Specify a Port for the ASP.NET Development Server
When you use the Visual Studio Development Server to run a file-system Web site or a Web application project, by default, the Visual Studio Development Server is invoked on a randomly selected port for localhost. For example, if you are testing a page called MyPage.aspx, when you run the page on the Visual Studio Development Server, the URL of the page might be the following:
http://localhost:31544/MyPage.aspx
If you want to run the Visual Studio Development Server on a specific port, you can configure the server to do so.
Note |
|---|
Visual Studio cannot guarantee that the port you specify will be available when you run your file-system Web site. If the port is in use when you run a page, Visual Studio displays an error message. |
To specify a port for the Visual Studio Development Server in a Web Site Project
-
In Solution Explorer, click the name of the site.
-
In the Properties pane, click the down-arrow beside Use dynamic ports and select False from the drop-down list.
This will enable editing of the Port number property.
-
In the Properties pane, click the text box beside Port number and type in a port number.
-
Click outside of the Properties pane. This saves the property settings.
To specify a port for the Visual Studio Development Server in a Web Application Project
-
In Solution Explorer, click the name of the site.
-
In the Project menu, click Properties.
-
Click the Web tab.
-
Click Specific port and enter a port number.
Note