【发布时间】:2013-01-30 08:50:15
【问题描述】:
在我的解决方案中,我有 5 个网站在 Visual Studios ASP.NET Development Server 上本地运行。
其中一个站点的代码中是否有一些代码(C# 或 VB.NET)可以找到 ASP.NET 开发服务器使用的所有端口?
【问题讨论】:
标签: c# asp.net .net vb.net port
在我的解决方案中,我有 5 个网站在 Visual Studios ASP.NET Development Server 上本地运行。
其中一个站点的代码中是否有一些代码(C# 或 VB.NET)可以找到 ASP.NET 开发服务器使用的所有端口?
【问题讨论】:
标签: c# asp.net .net vb.net port
查看Web Administration API,您需要特别查看Site 对象。
【讨论】:
试试。 Request.Url.Port
Request.Url.Port // will give the port of the server.
【讨论】: