public SiteDesiredState(Site iisSiteObject , IEnumerable <WebConfigPropertyDesiredState> authDesiredStateList , IISCodeGenerator.IisPoolAndSitesOptions iisOptions) { var rootApp = iisSiteObject.Applications[0]; this.Key = GetSiteKey(iisSiteObject.Name); this.AddAttribute("Name", iisSiteObject.Name); this.AddAttribute("Ensure", "Present"); this.AddAttribute("State", iisSiteObject.State.ToString()); this.ApplicationPool = rootApp.ApplicationPoolName; this.AddAttribute("ApplicationPool", this.ApplicationPool); this.AddAttributeWithComment("PhysicalPath", rootApp.VirtualDirectories[0].PhysicalPath, "This folder must already exist"); if (iisOptions.StandardizeLogFileLocation) { this.AddAttributeWithOverrideValue("LogFileDirectory", @"D:\IISLogs", iisSiteObject.LogFile.Directory); } else { this.AddAttribute("LogFileDirectory", iisSiteObject.LogFile.Directory); } this.AddAttribute("DependsOn", "[cAppPool]" + PoolDesiredState.GetPoolVariableName(this.ApplicationPool)); this.Bindings = GetBindings(iisSiteObject.Bindings); this.Applications = GetApplications(iisSiteObject.Applications, this.Key, this.Name); this.AuthDesiredStateList.AddRange(authDesiredStateList); }
public List <PoolDesiredState> BuildPools(IISCodeGenerator.IisPoolAndSitesOptions iisOptions) { ServerManager serverManager = new ServerManager(); List <PoolDesiredState> poolCodeList = new List <PoolDesiredState>(); var pools = serverManager.ApplicationPools; foreach (var pool in pools) { var poolCode = new PoolDesiredState(pool, iisOptions); poolCodeList.Add(poolCode); } return(poolCodeList); }
public List <SiteDesiredState> BuildSites(IISCodeGenerator.IisPoolAndSitesOptions iisOptions) { ServerManager serverManager = new ServerManager(); List <SiteDesiredState> siteCodeList = new List <SiteDesiredState>(); WebConfigPropertyDesiredStateAssembler gen = new WebConfigPropertyDesiredStateAssembler(); List <WebConfigPropertyDesiredState> authDesiredStateList = gen.GetAuthenticationDesiredStates(); foreach (var site in serverManager.Sites) { var siteName = site.Name; var siteAuthDesiredStateList = authDesiredStateList.Where(a => CodeGenHelpers.AreEqualCI(a.SiteName, siteName)); var siteCode = new SiteDesiredState(site, siteAuthDesiredStateList, iisOptions); siteCodeList.Add(siteCode); } return(siteCodeList); }
private IISCodeGenerator.IisPoolAndSitesOptions GetIisOptions() { var options = new IISCodeGenerator.IisPoolAndSitesOptions(); options.StandardizeAppPoolRecycles = StandardizeAppPoolRecyclesCtl.IsChecked.GetValueOrDefault(); options.KeepAppPoolsRunning = KeepAppPoolsRunningCtl.IsChecked.GetValueOrDefault(); options.StandardizeLogFileLocation = StandardizeLogFileLocationCtl.IsChecked.GetValueOrDefault(); if (GenerateIISSitesPoolsCtl.IsChecked.GetValueOrDefault() == false) options.IisPoolAndSitesGenerationMode = IISCodeGenerator.IisPoolAndSitesGenerationMode.NoGeneration; else if (GenerateIisSitesPoolsSortedCtl.IsChecked.GetValueOrDefault()) options.IisPoolAndSitesGenerationMode = IISCodeGenerator.IisPoolAndSitesGenerationMode.Alphabetical; else options.IisPoolAndSitesGenerationMode = IISCodeGenerator.IisPoolAndSitesGenerationMode.ConfigFileOrder; return options; }
public List <SiteDesiredState> BuildSites(IISCodeGenerator.IisPoolAndSitesOptions iisOptions) { ServerManager serverManager = new ServerManager(); List <SiteDesiredState> siteCodeList = new List <SiteDesiredState>(); List <WebConfigEntry> configEntryList = new WebConfigEntryAssembler().GetWebConfigEntries(); foreach (var site in serverManager.Sites) { var siteName = site.Name; List <WebConfigEntry> siteConfigEntryList = configEntryList.Where(a => CodeGenHelpers.AreEqualCI(a.SiteName, siteName)).ToList(); var siteCode = new SiteDesiredState(site, siteConfigEntryList, iisOptions); siteCodeList.Add(siteCode); } return(siteCodeList); }
private void Initialize(ApplicationPool iisPoolObject, IISCodeGenerator.IisPoolAndSitesOptions iisOptions) { this.Key = GetPoolVariableName(iisPoolObject.Name); this.AddAttribute("Name", iisPoolObject.Name); if (iisOptions.KeepAppPoolsRunning) { this.AddAttributeWithOverrideValue("AutoStart", true, iisPoolObject.AutoStart); } else { this.AddAttribute("AutoStart", iisPoolObject.AutoStart); } this.AddAttribute("ManagedPipelineMode", iisPoolObject.ManagedPipelineMode.ToString()); this.AddAttribute("ManagedRuntimeVersion", iisPoolObject.ManagedRuntimeVersion); this.AddAttribute("IdentityType", iisPoolObject.ProcessModel.IdentityType.ToString()); this.AddAttribute("Enable32BitAppOnWin64", iisPoolObject.Enable32BitAppOnWin64); if (iisOptions.StandardizeAppPoolRecycles) { string recycleTime = "$appPoolRecycleHour+':#PoolRecycleMins#'"; //tag mins so it can be injected at code gen this.AddAttributeWithOverrideValue("RestartSchedule", $"@({recycleTime})", GetScheduleString(iisPoolObject)); } else { this.AddAttribute("RestartSchedule", GetScheduleString(iisPoolObject)); } if (iisOptions.KeepAppPoolsRunning) { this.AddAttributeWithOverrideValue("IdleTimeout", "00:00:00", iisPoolObject.ProcessModel.IdleTimeout.ToString()); this.AddAttributeWithOverrideValue("RestartTimeLimit", "00:00:00", iisPoolObject.Recycling.PeriodicRestart.Time.ToString()); } else { this.AddAttribute("IdleTimeout", iisPoolObject.ProcessModel.IdleTimeout.ToString()); this.AddAttribute("RestartTimeLimit", iisPoolObject.Recycling.PeriodicRestart.Time.ToString()); } }
public SiteDesiredState(Site iisSiteObject , List <WebConfigEntry> configEntries , IISCodeGenerator.IisPoolAndSitesOptions iisOptions) { var rootApp = iisSiteObject.Applications[0]; this.Key = GetSiteKey(iisSiteObject.Name); this.AddAttribute("Name", iisSiteObject.Name); this.AddAttribute("Ensure", "Present"); this.AddAttribute("State", iisSiteObject.State.ToString()); this.ApplicationPool = rootApp.ApplicationPoolName; this.AddAttribute("ApplicationPool", this.ApplicationPool); this.AddAttributeWithComment("PhysicalPath", rootApp.VirtualDirectories[0].PhysicalPath, "This folder must already exist"); string logAttributeName = "LogPath"; if (iisOptions.StandardizeLogFileLocation) { this.AddAttributeWithOverrideValue(logAttributeName, "$logFilePath", iisSiteObject.LogFile.Directory); } else { this.AddAttribute(logAttributeName, iisSiteObject.LogFile.Directory); } this.AddAttribute("DependsOn", "[xWebAppPool]" + PoolDesiredState.GetPoolVariableName(this.ApplicationPool)); this.Bindings = GetBindings(iisSiteObject.Bindings); this.AuthenticationInfo = GetSiteAuthenticationConfiguration(configEntries, iisSiteObject.Name); Dictionary <string, WebAuthenticationInformation> authEntries = GetAppsAuthenticationConfigurations(configEntries); this.Applications = GetApplications(iisSiteObject.Applications, this.Key, this.Name, authEntries); //todo this.AllWebConfigEntryList.AddRange(configEntries); }
public PoolDesiredState(ApplicationPool iisPoolObject, IISCodeGenerator.IisPoolAndSitesOptions iisOptions) { Initialize(iisPoolObject, iisOptions); }