How the localhost port number of .NET Development Server set?

一曲冷凌霜 提交于 2019-12-08 15:41:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!