Microsoft.Web.Administration.dll是可再发行的吗?

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

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; } } } } } 

请帮我解决这个问题。

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