I am writing a Windows 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 )
When I run the following code:
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;
}
}
}
}
The service starts as an administrator, and the GetRequests (0) method raises the following exception:
System.NotImplementedException - {"The method or operation is not implemented."}
Stacktrace:
at Microsoft.Web.Administration.Interop.IAppHostMethodInstance.Execute()
at Microsoft.Web.Administration.ConfigurationMethodInstance.Execute()
at Microsoft.Web.Administration.WorkerProcess.GetRequests(Int32 timeElapsedFilter)
Got the same exception in PowerShell using the following code:
PS > [System.Reflection.Assembly]::LoadFrom("C:\windows\system32\inetsrv\Microsoft.Web.Administration.dll" )
PS > $sm = new-object Microsoft.Web.Administration.ServerManager
PS > $sm.workerprocesses | foreach-object {$_.GetRequests(0)}
Can someone advise me?
source
share