Visual Studio在浏览器中打开文件时,本地主机端口号从何而来?

Where does the localhost port number come from when a file is opened in the browser from Visual Studio?

如果我在 VS2013 中打开一个 index.html 文件并且该文件位于我的 C: 我的 URL 是 localhost:496989/index.html

如果我的文件位于我的 E: 端口号不同

端口号是如何确定的?

它们是在您创建新网站或网络应用程序时随机分配的。

端口号存储在项目中,例如

%USERPROFILE%\Documents\Visual Studio 2015\Projects\WebSite1\.vs\config\applicationhost.config

或在 IIS Express 的主配置文件中:

%USERPROFILE%\Documents\IISExpress\config\applicationhost.config

此配置文件在 Visual Studio

中打开站点时传递给 IIS Express

我在 2015 年看过这个,但我认为它在 2013 年也是一样。