views:

275

answers:

5

When you run an application from within visual studio, it seems to pick a random port on localhost. For example, running an application right now, I get

http://localhost%3A3240/ApplicationStuffHere

I realize this port gets loaded into the solution file, via

VWDPort = "3240"

How does this get decided on? it seems fairly random.

+1  A: 

check here

Peter Mourfield
Yeap- sometimes it is better to force it to use the same port.
RichardOD
A: 

Check out the Properties of your web application in solution explorer (Right click > Properties)

The web tab is the one you are looking for.

Kindness,

Dan

Daniel Elliott
Web tab? Right click -> Properties yields a sidebar with Common Properties and Configuration Properties. No web tab. This is VS2005, should have specified.
Chris
Ah ... I am looking at 2008, sorry
Daniel Elliott
Is your project a web application?
Daniel Elliott
Yes it is. I am right clicking on the solution itself in the solution explorer, yes?
Chris
No actually on the project inside the solution, sir :)
Daniel Elliott
+3  A: 
rahul
+1  A: 

This port number is initially assigned randomly, but Visual Studio will try to use that same port number every time the application starts.

mc2thaH
+1  A: 

I know this is a little bit old, but I was wondering the same thing. I eventually found the answer for VS2005, but figured I'd share it with the stack overflow community.

  1. Open your project
  2. Click (not right click) on the name of the project in the solution explorer (that top, bolded line)
  3. Hit f4 - this will bring up a properties panel
  4. Change "Use dynamic ports" to False
  5. Optionally change the Port number to whatever port you want to use

And you're done.

Ryan Kinal