Microsoft.Web.Administration.ServerManager连接到IIS Express而不是完整的IIS [英] Microsoft.Web.Administration.ServerManager is connecting to the IIS Express instead of full IIS

查看:669
本文介绍了Microsoft.Web.Administration.ServerManager连接到IIS Express而不是完整的IIS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用它来创建 ServerManager的实例

[Void][Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")
$serverManager = New-Object Microsoft.Web.Administration.ServerManager

运行 $ serverManager.ApplicationPools时选择-Property名称我得到:

Name
----
Clr4IntegratedAppPool
Clr4ClassicAppPool
Clr2IntegratedAppPool
Clr2ClassicAppPool
UnmanagedClassicAppPool

运行 $ serverManager.Sites |时选择-Property Bindings 我得到:

Bindings
--------
{[http] :8080:localhost}
{[http] *:23700:localhost}
{[http] *:58996:localhost}
{[http] *:62159:localhost}
{[http] *:51643:localhost}
{[http] *:64256:localhost}
{[http] *:50934:localhost}
{[http] *:53107:localhost}
{[http] *:49414:localhost}
{[http] *:59074:localhost}
{[http] *:61886:localhost}
{[http] *:57546:localhost}
{[http] *:63087:localhost}
{[http] *:63838:localhost}
{[http] *:63727:localhost}
{[http] *:60172:localhost}

所以它似乎是连接到IIS Express而不是我的完整IIS。如何让它连接到完整的IIS呢? 文档未列出任何接受的重载参数,至少没有供公众使用。

So it seems to be connecting to IIS Express instead of my full IIS. How can I make it connect to full IIS instead? The documentation doesn't list any overloads accepting parameters, at least none intended for public use.

推荐答案

DLL有两个版本。完整IIS包含7.0.0.0,IIS Express包含7.9.0.0。这两个版本也都在GAC中。

There are two versions of the DLL. 7.0.0.0 is included with full IIS, 7.9.0.0 is included with IIS Express. Both versions are also in the GAC.

指定版本7.0.0.0允许访问完整的IIS:

Specifying version 7.0.0.0 allows access to the full IIS:

[Void][Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL")

同时我还发现不推荐使用 LoadWithPartialName ,这是目前的方法:

Meanwhile I also found that LoadWithPartialName is deprecated, this is the current way to do it:

Add-Type -AssemblyName "Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"

这篇关于Microsoft.Web.Administration.ServerManager连接到IIS Express而不是完整的IIS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆