【问题标题】:Code to get all ports used by ASP.NET Development Server获取 ASP.NET 开发服务器使用的所有端口的代码
【发布时间】: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


    【解决方案1】:

    查看Web Administration API,您需要特别查看Site 对象。

    【讨论】:

      【解决方案2】:

      试试。 Request.Url.Port

      Request.Url.Port // will give the port of the server. 
      

      【讨论】:

      • 这只会给你网站的端口,通常是 80。
      猜你喜欢
      • 2016-01-20
      • 2011-02-20
      • 2020-02-19
      • 2013-10-10
      • 2014-02-23
      • 2019-12-08
      • 1970-01-01
      • 2010-10-11
      相关资源
      最近更新 更多