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)); }
public static IISAppPool CreateAppPool(string name) { DirectoryEntry Service = new DirectoryEntry("IIS://localhost/W3SVC/AppPools"); foreach (DirectoryEntry entry in Service.Children) { if (entry.Name.Trim().ToLower() == name.Trim().ToLower()) { return(IISAppPool.OpenAppPool(name.Trim())); } } DirectoryEntry appPool = Service.Children.Add(name, "IIsApplicationPool"); appPool.CommitChanges(); Service.CommitChanges(); return(new IISAppPool(appPool)); }
/// <summary> /// create application from this dir /// </summary> /// <param name="appPool">app pool to use, null means default</param> public void CreateApplication(IISAppPool appPool) { if (appPool == null) { this.server.Invoke("AppCreate", true); } else { this.server.Invoke("AppCreate3", new object[] { 0, appPool.Name, true }); } this.server.Properties["AppFriendlyName"].Clear(); this.server.Properties["AppIsolated"].Clear(); this.server.Properties["AccessFlags"].Clear(); this.server.Properties["FrontPageWeb"].Clear(); this.server.Properties["AppFriendlyName"].Add(this.server.Name); this.server.Properties["AppIsolated"].Add(2); this.server.Properties["AccessFlags"].Add(513); this.server.Properties["FrontPageWeb"].Add(1); //siteVDir.Invoke("AppCreate3", new object[] {2, "DefaultAppPool", true}); this.server.CommitChanges(); }