public static bool DeleteAppPool(string name) { if (IISAppPool.IsExist(name) == false) { return(false); } IISAppPool appPool = IISAppPool.OpenAppPool(name); appPool._entry.DeleteTree(); return(true); }
public static IISAppPool OpenAppPool(string name) { string connectStr = "IIS://localhost/W3SVC/AppPools/"; connectStr += name; if (IISAppPool.IsExist(name) == false) { return(null); } DirectoryEntry entry = new DirectoryEntry(connectStr); return(new IISAppPool(entry)); }