Visual Studio 2010 Web Development Port
I've noticed that Visual Studio like to change the port used for my application from time to time, and I was wondering why. After some Stack Overflow reading, I've found solutions to prevent this (it is possible to assign a static port). However, I do not find it to be a problem (merely a curiosity) and do not need to a assign a static port. I just want to know why it does that.
While debugging my application, VS will run on one port. On another run 5 or开发者_JAVA技巧 ten minutes later, it will run on an entirely different port. As far as I know, no other processes on my machine are using these same ports, so why the change? Once it finds an available port, why does it not continue to use it?
This is by design. Either you can have random ports every time, or you can assign a fixed one per project. Keeps things simple I guess (rather than figuring out if the previously used port is taken or not and then based on that, use the old one or a new one)!
As Mrchief said, this is by design. You can opt to use IIS by creating a virtual directory and making the appropriate selection on the Web tab of the project properties.
Then your URL (can debug also) will look like:
http://localhost/myproject
Port 80 will now be the default :)
精彩评论