public override bool Verify() { TaskLogger.LogEnter(); bool result = IisUtility.IsSupportedIisVersion(this.ServerName); TaskLogger.LogExit(); return(result); }
public void Execute() { DirectoryEntry directoryEntry = IisUtility.CreateWebDirObject(this.Parent, this.LocalPath, this.Name); if (this.CustomizedVDirProperties != null) { IisUtility.SetProperties(directoryEntry, this.CustomizedVDirProperties); } directoryEntry.CommitChanges(); string hostName = IisUtility.GetHostName(this.Parent); IisUtility.CommitMetabaseChanges(hostName); if (this.ApplicationPool != null && IisUtility.IsSupportedIisVersion(hostName)) { string appPoolRootPath = IisUtility.GetAppPoolRootPath(hostName); if (!IisUtility.Exists(appPoolRootPath, this.ApplicationPool, "IIsApplicationPool")) { using (DirectoryEntry directoryEntry2 = IisUtility.CreateApplicationPool(hostName, this.ApplicationPool)) { IisUtility.SetProperty(directoryEntry2, "AppPoolIdentityType", (int)this.AppPoolIdentityType, true); IisUtility.SetProperty(directoryEntry2, "managedPipelineMode", (int)this.AppPoolManagedPipelineMode, true); if (this.AppPoolQueueLength != 0) { IisUtility.SetProperty(directoryEntry2, "AppPoolQueueLength", this.AppPoolQueueLength, true); } directoryEntry2.CommitChanges(); IisUtility.CommitMetabaseChanges(hostName); using (ServerManager serverManager = new ServerManager()) { ApplicationPool applicationPool = serverManager.ApplicationPools[this.ApplicationPool]; applicationPool.ProcessModel.LoadUserProfile = true; if (this.MaximumMemory != 0L) { applicationPool.Recycling.PeriodicRestart.Memory = this.MaximumMemory; } if (this.MaximumPrivateMemory != 0L) { applicationPool.Recycling.PeriodicRestart.PrivateMemory = this.MaximumPrivateMemory; } serverManager.CommitChanges(); } } } IisUtility.AssignApplicationPool(directoryEntry, this.ApplicationPool); } }
public void Execute() { this.checkPoints.Clear(); this.SaveLocalPath(); this.SaveAppPoolName(); try { IisUtility.FindWebDirObject(this.Parent, this.Name); IisUtility.DeleteWebDirObject(this.Parent, this.Name); this.checkPoints.Push(DeleteVirtualDirectory.CheckPoint.VirtualDirectoryDeleted); } catch (WebObjectNotFoundException) { } string hostName = IisUtility.GetHostName(this.parent); if (this.applicationPool != null && IisUtility.IsSupportedIisVersion(hostName)) { if (!this.DeleteApplicationPool) { if (!IisUtility.ApplicationPoolIsEmpty(this.applicationPool, hostName)) { return; } } try { string appPoolRootPath = IisUtility.GetAppPoolRootPath(hostName); IisUtility.FindWebObject(appPoolRootPath, this.applicationPool, "IIsApplicationPool"); IisUtility.DeleteApplicationPool(hostName, this.applicationPool); this.checkPoints.Push(DeleteVirtualDirectory.CheckPoint.ApplicationPoolDeleted); } catch (WebObjectNotFoundException) { } } }