C# 获取IIS站点以及程序池信息
using Microsoft.Web.Administration;
ServerManager serverManager = ServerManager.OpenRemote(ip);
if (serverManager == null)
{
throw new Exception("获取到数据为空!");
}
ApplicationPoolCollection appPools = serverManager.ApplicationPools;
if (appPools == null)
{
throw new Exception("获取到数据为空!");
}
if (appPools.Count <= 0)
{
throw new Exception("iis应用池 无数据!");
}
foreach (ApplicationPool ap in appPools)
{
string Name = ap.Name;
ObjectState state = ap.State;
}
IP录入127.0.0.1即可