Tip #21: Did you know...How to set a fixed port for the Developer Web Server?

Technorati Tags: Visual Studio 2008,VS2008,VWD,tips and tricks,Visual Studio,Cassini,Developer Web Server

When you create a file based web site, the "Developer Web Server" is fired up on a local port to serve the web site.  By default, the port value used is dynamic based on a pre-defined range and the availability of a port.  In some situations, you might want the web server to always use a fixed port value.

Here's how to do configure this:

  1. If the Properties window in Visual Studio is not already opened, open it with "F4" or via the toolbar - "View" -> "Properties Window".

  2. Left click on your web site in the "Solution Explorer" window.

  3. You'll now see a dialog similar to the following:

    CassiniDynamicPorts

    Notice the drop down list for the "Use dynamic ports" setting.  If you set this to "False" , you'll then be able to specify a fixed port in the "Port number" field.  Set this to your desired port value.

  4. Launch your web site.  You'll see the port used matches the value you specified.

 
Mark Berryman
SDET, ASP.NET QA Team