在IIS枚举应用程序池 [英] Enumerating Application Pools in IIS
本文介绍了在IIS枚举应用程序池的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有一种方法来枚举应用程序池的集合(而不是在一个给定池中的应用程序 - 但池本身)使用ASP.net 3.5,而无需使用WMI的本地IIS服务器上,如果所以有人可以提供一个链接或例子,如何做到这一点?
I am wondering if there is a way to enumerate the collection of applications pools (not the applications in a given pool - but the pools themselves) on the local IIS server using ASP.net 3.5 without the use of WMI, and if so can someone provide a link or example to how this is done?
(我忘了添加IIS版本是6.0)。
(I forgot to add the IIS version is 6.0).
推荐答案
这应该帮助:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.DirectoryServices;
namespace AppPoolEnum
{
class Program
{
static void Main(string[] args)
{
DirectoryEntries appPools =
new DirectoryEntry("IIS://localhost/W3SVC/AppPools").Children;
foreach (DirectoryEntry appPool in appPools)
{
Console.WriteLine(appPool.Name);
}
}
}
}
我还要补充这不会在部分信任的工作。
I should also add this won't work in partial trust.
这篇关于在IIS枚举应用程序池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文