14

I have a WebSite project in Visual Studio 2008 (not a Web Application project!)

How do I set the ASP.NET Development startup port to a static port in a WebSite project?

BrokenGlass
  • 158,293
  • 28
  • 286
  • 335
Alex Czarto
  • 3,151
  • 4
  • 28
  • 28
  • Can't be done. Perhaps if you tell us why you'd prefer this we can suggest an alternate solution. – Spencer Ruport Jul 14 '09 at 16:30
  • It's a legacy project, and currently converting it into a Web Application is not worth the effort just to get the static port number working. It is something we will do in the future, just not now... – Alex Czarto Jul 15 '09 at 18:58

4 Answers4

28

To specify a port for the ASP.NET Development Server - WebSite / WebServices projects

  1. In Solution Explorer, click the name of the application.
  2. In the Properties pane, click the down-arrow beside Use dynamic ports and select False from the dropdown list. This will enable editing of the Port number property.
  3. 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.
  4. Each time you run a file-system Web site within Visual Web Developer, the ASP.NET
    Development Server will listen on the specified port.
backslash17
  • 5,300
  • 4
  • 31
  • 46
  • 2
    +1 superb, been bugging me for months this. I would recommend hitting F4 to get to the properties! – Rippo Dec 30 '10 at 12:37
4

Press F4 to get the Properties Pane. And then one can get the option mentioned by Backslash17

Community
  • 1
  • 1
Neeraj Gulia
  • 640
  • 8
  • 24
1

For web site assigning port is not possible form VS Properties Page interface but if you start your web site from command line then you can assign the port (If you want to debug the site you can attach after starting the web site)

WebDev.WebServer40.exe

path is

"C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0\" or "C:\Program Files\Common Files\microsoft shared\DevServer\10.0\"

ASP.NET Development Server Usage: WebDev.WebServer40 /port: /path: [/vpath:]

Example:

WebDev.WebServer40 /port:8080 /path:"c:\inetpub\wwwroot\MyApp" /vpath:"/MyApp"

Ozgur
  • 258
  • 3
  • 13
0

It can't be done with a Website project, the port number is randomly assigned.

It's only possible with a Web App Project

dxbmatt
  • 543
  • 3
  • 6