得到了一个错误,同时从Microsoft.Web.Administration.dll使用WorkerProcess.GetRequests方法IIS 8.5 [英] Got an error while using WorkerProcess.GetRequests method from Microsoft.Web.Administration.dll IIS 8.5

查看:965
本文介绍了得到了一个错误,同时从Microsoft.Web.Administration.dll使用WorkerProcess.GetRequests方法IIS 8.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写在C#中的窗口服务应用程序(.NET框架4.5)的Microsoft Windows Server 2012中R2 x64标准(IIS 8.5),并使用Microsoft.Web.Administration.dll(7.0.0.0从C:\Windows 。\System32\inetsrv)

I'm writing a windows service application in C# (.NET Framework 4.5) for Microsoft Windows Server 2012 R2 Standard x64 (IIS 8.5) and using Microsoft.Web.Administration.dll (7.0.0.0 from C:\Windows\System32\inetsrv).

当我运行下面的代码:

using(var srvmngr = new Microsoft.Web.Administration.ServerManager())
{
    foreach(var pl in srvmngr.ApplicationPools)
    {
         foreach (var w3wp in pl.WorkerProcesses)
         {
             foreach (var request in w3wp.GetRequests(0))
             {
                 var success = true;
             }
        }
    }
}



服务具有管理员权限的开始,GetRequest的(0)方法引发以下异常:

The Service starts with administrator privileges and "GetRequests(0)" method raises the following exception:

System.NotImplementedException - {"The method or operation is not implemented."}

堆栈跟踪:

at Microsoft.Web.Administration.Interop.IAppHostMethodInstance.Execute()
at Microsoft.Web.Administration.ConfigurationMethodInstance.Execute()
at Microsoft.Web.Administration.WorkerProcess.GetRequests(Int32 timeElapsedFilter)

使用下面的代码得到了在PowerShell中相同的异常

Got the same exception in PowerShell using the following code:

PS > [System.Reflection.Assembly]::LoadFrom("C:\windows\system32\inetsrv\Microsoft.We‌​‌​b.Administration.dll" )
PS > $sm = new-object Microsoft.Web.Administration.ServerManager
PS > $sm.workerprocesses | foreach-object {$_.GetRequests(0)}



有人能指点我?

Can someone advice me?

推荐答案

我终于解决了我的问题。

I finally have solved my problem.

请按照下面的步骤来完成这个问题:
添加角色和功能向导 - >服务器角色 - > Web服务器(IIS) - > Web服务器 - >运行状况和诊断 - >请求监视器

Follow the steps below to complete this problem: Add Roles and Features Wizard -> Server Roles -> Web Server (IIS) -> Web Server -> Health and Diagnostics -> Request Monitor

这篇关于得到了一个错误,同时从Microsoft.Web.Administration.dll使用WorkerProcess.GetRequests方法IIS 8.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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