how to get the application pool name for a specific website IIS6 programmatically? C#

前端 未结 3 1901
小鲜肉
小鲜肉 2021-01-06 11:14

how to get the application pool name for a specific website IIS 6 programmatic using C#

EDIT: I already used the methods of DirectoryServices namespace but the appl

3条回答
  •  不思量自难忘°
    2021-01-06 11:44

    In brief, there's 2 ways of doing this that spring to mind.

    The less sophisticated way is knowing that, IIS6's settings are stored in the MetaBase which is just an Xml file:

    C:\WINDOWS\system32\inetsrv\MetaBase.xml
    

    You can just use Linq2Xml and parse the Xml looking for the sites name or Id, The AppPoolId attribute contains the name of the AppPool

    The proper way is to use System.DirectoryServices

提交回复
热议问题