Randomly assigned ports in ASP.NET


By default, Visual Studio and Visual Web Developer Express, randomly or dynamically assigns a TCP port to a new Web Site or Web Application when you create them. This is just fine when you’re testing functionality, but not so when you need to test access etc. after moving it to IIS. Now, here is how you change it:

Web Site Project (WSP)

  1. Right-click the Web site in Solution Explorer.
  2. Press F4 to open the Properties window, if not already open.
  3. In the Properties window, click False in the Use dynamic ports list.
  4. In the Port number box, type the desired port number.

wsppropertieswindow

Web Application project (WAP)

  1. Right-click the project in Solution Explorer, and then click Properties.
  2. In the Properties dialog box, click the Web tab.
  3. On the Web tab, click the Specific port option, and type the port number in the box next to the Specific port option.
  4. Close the Options dialog box.

wappropertiesdialogboxwebtab

Advertisements