问题
I see that time to time localhost port number changes (http://localhost:1519/ ....).
Basically how does it being set or chosen? And when does it change?
Thanks!
回答1:
It's just a random number:
When you use the ASP.NET Development Server to run a file-system Web site, by default, the Web server is invoked on a randomly selected port for localhost.
Although you can specify it yourself by disabling dynamic ports.
Take a look at : How to: Specify a Port for the ASP.NET Development Server
回答2:
You can set it here:
Choose "Use dynamic port = false"
alt text http://img110.imageshack.us/img110/8444/59650554.jpg
回答3:
The setting is placed in the properties of the project. Right click your project file and chose the Web Tab. If it is set to Auto-assigned Port, the Visual studio would randomly give you a port number. But you could chose the Specific port to assign your own port number.
回答4:
You can set this in the properties window on the website, there is an option to assign it as dynamic or choose a fixed port called "Use dynamic port", set this to false and then choose your port number.
来源:https://stackoverflow.com/questions/1576970/how-the-localhost-port-number-of-net-development-server-set