【问题标题】:Is Microsoft.Web.Administration.dll Redistributable?Microsoft.Web.Administration.dll 是否可再发行?
【发布时间】:2012-04-20 14:41:10
【问题描述】:

我们正在客户机器中使用 IIS 中的 ServerManager 类访问默认端口号。但是控制台没有运行某些机器并显示 Microsoft.Web.Administration.dll 是必需的。这个程序集是可再发行的吗?或者有没有其他方法可以获取默认端口号? 我正在使用下面的代码来获取端口号。

using (ServerManager serverManager = new ServerManager())
        {
            SiteCollection allsites = serverManager.Sites;
            foreach (Site site in allsites)
            {
                if (site.Name == "Default Web Site")
                {
                    BindingCollection allBindings = site.Bindings;
                    foreach (Binding bind in allBindings)
                    {
                        if (bind.Protocol == "http")
                        {
                            PortNo = bind.BindingInformation.ToString();
                            int portNoLenth = PortNo.Length; PortNo = PortNo.Substring(2, portNoLenth - 3); break;
                        }
                    }
                }
            }
        }

请帮我解决这个问题。

【问题讨论】:

    标签: c# iis-7


    【解决方案1】:

    不,它不可再发行,它应该安装在带有 IIS 的机器上。即使您这样做了,它也可能无法工作,因为它依赖于需要存在和注册的其他库(本机代码 DLL)。

    【讨论】:

    • 感谢您的回答。如果 IIS 安装在客户机器中,我已经使用此代码创建了另一个控制台并调用控制台。它可以帮助我解决它
    【解决方案2】:

    我知道这是一篇较旧的帖子,但我相信它现在可以重新分发,因为如果您尝试添加对它的引用,它会在扩展下显示为一个程序集。

    【讨论】:

    • 你提到的版本是针对IISExpress的,不适用于IIS。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-19
    • 1970-01-01
    • 2014-12-08
    相关资源
    最近更新 更多