开发者

Why the Visual-Studio development server auto-assigns the port number?

What is the main reason for Visual-Studio to assign (auto-assign) a new port numbe开发者_开发百科r to the development server?


By using a random port way above the so-called well-known ports there'll be less change for the port to be in use by another application.

Visual Studio randomizes the port on project creation:

By default, when you create a Web site or a Web application project in Visual Studio that uses IIS Express or the Visual Studio Development Server, a port is selected for the project.

But if the port is in use when starting to debug the project, it'll auto-assign a new random, free port.

See here how to alter this behaviour and manually assign a static port number.


Because if it didn't assign a port then it would use port 80 which wouldn't work for anyone with IIS / Apache / another web servier in its default configuration.

Seeing as its got to choose a port number, it just chooses one which is free at the point when the development web server is started.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜