Tip #21: Did you know…How to set a fixed port for the 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


Comments (12)

  1. Dan Kline says:

    Your VS works differently from mine.  All I have is a Misc. Tab not a Developer Server Tab.  Am I missing something?

  2. Mark Berryman says:

    Any chance you created an IIS based web site instead of a file based web site?  The Developer Web Server is only used for file based web sites.

  3. Latest on Tips and Tricks Blog. Tip #13: Did you know… How to get the browser agent using ASP.NET Ajax

  4. I’m flying out later today on a pretty intense business trip (22,000 miles, 5 countries, 3 continents

  5. I’m flying out later today on a pretty intense business trip (22,000 miles, 5 countries, 3 continents,

  6. 【原文地址】 Dec 2nd Links: ASP.NET, ASP.NET Dynamic Data, ASP.NET AJAX, ASP.NET MVC, Visual Studio, Silverlight/WPF

  7. Steve Bohlen says:

    @Dan:

    This tip only applies to the ‘file-based’ web site project introduced in VS 2005.  If you are using a .csproj- or .vbproj-based ‘Web Application Project’ (the defaut in VS 2003, released as a hotfix to VS 2005 and then later made part of the VS 2005 SP1 release and also present from the get-go in VS 2008) then the steps are completely different:

    1) Right-click on the project in the solution explorer, select properties

    2) click on the ‘Web’ tab of the project properties page

    3) Under the ‘servers’ section, select ‘specific port’ and enter the fixed port you want to use

    The difference between what you have to do for a Web Site Project and a Web Application Project is because in the Web Site Project there isn’t any .proj file to store your CASSINI dev webserver port settings.

    HTH,

    -Steve B.

  8. Сегодня я улетаю в очень насыщенную деловую поездку (22000 миль, 5 стран, 3 континента, 1 неделя, никакого

  9. BeexhorkdrerY says:

    Соберем для Вас по сети интернет

    базу данных потенциальных клиентов для Вашего Бизнеса

    (Название телефон факс email www имена адреса итд)

    Более подробную информацию Вы сможете получить по

    телефону +79133913837

    ICQ: 6288862

    SKYPE: prodawez

    EMAIL: prodawez@mixmail.com

  10. bpimenta says:

    It has been a while since this post has been written but it still helped me. To find the properties panel, just click on the website name and press 'F4' key. Using the right button option it did not work for me.

    Thanks,

  11. C# Programmer says:

    This will only work if the application stays on the current system. As soon as you try to move it to a different media (flash), the "use dynamic port" property gets set back to "true" and chances the port number. How can one prevent that?

    I'm using Web development asp.net 2008