1

I am running IIS 7.5 Under Windows 2008 R2 (I use Windows 8.1 in development).
I use VS 2012 in Windows 8.1.
I use ASP.NET 4.5. .NET 4.5.1 in my project csproj.

Programmatically How-to know if Application Pool mode is Classic or Integrated ?

Kiquenet
  • 14,494
  • 35
  • 148
  • 243

1 Answers1

2

U need to use the Microsoft.Web.Administration namespace. You can get this from NuGet or from %WinDir%\System32\InetSrv\Microsoft.Web.Administration.dll

With the ServerManager class you can get the applicationpool you need. the property on the applicationpool you're looking for is ManagedPipelineMode.

var serverManager = new ServerManager();
var appPool = serverManager.ApplicationPools[0]; // get appPool by Index or by appPoolName
var managedPipelineMode = appPool.ManagedPipelineMode;

The return value can either be 0 or 1:

0 - Integrated - The managed pipeline runs in Integrated mode.

1 - Classic - The managed pipeline runs in ISAPI mode.

Sievajet
  • 3,443
  • 2
  • 18
  • 22
  • 1
    ***http://stackoverflow.com/a/11275987/206730*** without referencing the `Microsoft.Web.Administration` assembly. The `System.Web.HttpRuntime` class has the `UsingIntegratedPipeline` boolean property. – Kiquenet Nov 25 '15 at 22:59