连接 IIS7 时出现 WMI 错误
我收到此处描述的相同错误:
http://forums.iis.net/p /1033115/1700749.aspx
我有一个 PowerShell cmdlet,它尝试控制在 Windows Server 2008 SP2 和 IIS 7 上运行的 Web 应用程序。它尝试做的第一件事就是尝试使用以下命令连接到远程计算机: WMI。它使用如下代码来完成此操作:
ConnectionOptions connection = new ConnectionOptions();
connection.Authentication = AuthenticationLevel.PacketPrivacy;
this.iisScope = new ManagementScope(@"\\" + this.Name + @"\root\WebAdministration", connection);
this.iisScope.Connect();
this.Name 是服务器名称。此代码始终有效(不会引发异常),但在远程计算机上,我在 Windows 事件日志中收到此错误:
访问根目录\WebAdministration 命名空间被拒绝,因为 命名空间标记为 需要加密,但脚本或 应用程序尝试连接到 这个带有身份验证的命名空间 级别低于 Pkt_Privacy。改变 Pkt_Privacy 的身份验证级别 并运行脚本或应用程序 再次。
但随着 cmdlet 继续运行,它使用 this.iisScope 执行一些查询,并且全部成功,并且再也不会出现该错误。我对发生的事情有一个猜测,但我不知道如何证明它。我认为它尝试在没有数据包隐私的情况下进行连接,失败,然后尝试使用数据包隐私。我尝试用 Wireshark 嗅探数据包,但这并没有告诉我任何有用的信息。
I am getting the same error described here:
http://forums.iis.net/p/1033115/1700749.aspx
I have a PowerShell cmdlet that tries to control our web application running on Windows Server 2008 SP2 and IIS 7. One of the first things it tries to do is try to connect to the remote machine using WMI. It does this using code like this:
ConnectionOptions connection = new ConnectionOptions();
connection.Authentication = AuthenticationLevel.PacketPrivacy;
this.iisScope = new ManagementScope(@"\\" + this.Name + @"\root\WebAdministration", connection);
this.iisScope.Connect();
this.Name is the server name. This code always works (does not throw an exception), but on the remote machine I get this error in the Windows Event Logs:
Access to the root\WebAdministration
namespace was denied because the
namespace is marked with
RequiresEncryption but the script or
application attempted to connect to
this namespace with an authentication
level below Pkt_Privacy. Change the
authentication level to Pkt_Privacy
and run the script or application
again.
But as the cmdlet goes on, it does some queries using this.iisScope and they all succeed, and that error is never seen again. I have a guess as to what is going on, but I’m not sure how to prove it. I think that it is trying to connect without the Packet Privacy, failing, and then trying to use Packet Privacy. I tried to sniff the packets with Wireshark, but that didn’t tell me anything useful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论