public override void Configure(IOfferRemoteComposition server, IOfferInfrastructure require) { var bindings = _options.Values.HttpBindings.Select(httpBinding => string.Format("@{{protocol='http';bindingInformation='{0}:{1}:{2}'}}", httpBinding.Ip, httpBinding.Port, httpBinding.HostName)).ToList(); foreach (var httpsBinding in _options.Values.HttpsBindings) { if (httpsBinding.FindType == X509FindType.FindByThumbprint) { httpsBinding.FindName = httpsBinding.FindName.Replace(" ", ""); } var type = httpsBinding.FindType.GetType(); bindings.Add(string.Format("@{{protocol='https';bindingInformation='{0}:{1}:{2}';findType=[{3}]::{4};findValue='{5}'}}", httpsBinding.BindingOptions.Ip, httpsBinding.BindingOptions.Port, httpsBinding.BindingOptions.HostName, type.FullName, httpsBinding.FindType, httpsBinding.FindName)); } server.ExecuteRemote.PowerShell(string.Format(@"New-ConDepIisWebSite '{0}' {1} {2} {3} '{4}';" , _webSiteName , _id , "@(" + string.Join(",", bindings) + ")" , (string.IsNullOrWhiteSpace(_options.Values.PhysicalPath) ? "$null" : "'" + _options.Values.PhysicalPath + "'") , _options.Values.AppPool) , o => o.WaitIntervalInSeconds(30).RetryAttempts(3)); foreach(var webApp in _options.Values.WebApps) { require.IISWebApp(webApp.Item1, _webSiteName, webApp.Item2); } }
public override void Configure(IOfferInfrastructure require, ConDepConfig config) { require.IIS(); require .IIS() .IISAppPool("Bogus", options => options .Enable32Bit(false) .IdleTimeoutInMinutes(0) .LoadUserProfile(true) .ManagedPipeline(ManagedPipeline.Integrated) .NetFrameworkVersion(NetFrameworkVersion.Net4_0) .RecycleTimeInMinutes(0) ) .SslCertificate.FromFile(@"C:\somecert.pfx", "12345", certOpt => certOpt.AddPrivateKeyPermission("torresdal\\condeptest")) //.SslCertificate.FromStore(X509FindType.FindByThumbprint, "cb 5f 27 74 dc 0a 00 65 ba 5a ab 23 b4 63 ab 3f 9c 48 8e 5c", certOpt => certOpt.AddPrivateKeyPermission("z63\\__104171dep")) .IISWebSite("ConDepWebSite55", 5, opt => opt .AddHttpBinding(httpOpt => httpOpt .HostName("www.con-dep.net") .Port(80)) .AddHttpsBinding( X509FindType.FindByThumbprint, "cb 5f 27 74 dc 0a 00 65 ba 5a ab 23 b4 63 ab 3f 9c 48 8e 5c", binding => binding.HostName("www.con-dep.net").Port(443) ) .ApplicationPool("Bogus") .WebApp("MyWebApp", webAppOpt => webAppOpt .PhysicalPath(@"C:\temp\MyWebApp")) ); }
public override void Configure(IOfferRemoteComposition server, IOfferInfrastructure require) { var bindings = _options.Values.HttpBindings.Select(httpBinding => string.Format("@{{protocol='http';bindingInformation='{0}:{1}:{2}'}}", httpBinding.Ip, httpBinding.Port, httpBinding.HostName)).ToList(); foreach (var httpsBinding in _options.Values.HttpsBindings) { if (httpsBinding.FindType == X509FindType.FindByThumbprint) { httpsBinding.FindName = httpsBinding.FindName.Replace(" ", ""); } var type = httpsBinding.FindType.GetType(); bindings.Add(string.Format("@{{protocol='https';bindingInformation='{0}:{1}:{2}';findType=[{3}]::{4};findValue='{5}'}}", httpsBinding.BindingOptions.Ip, httpsBinding.BindingOptions.Port, httpsBinding.BindingOptions.HostName, type.FullName, httpsBinding.FindType, httpsBinding.FindName)); } server.ExecuteRemote.PowerShell(string.Format(@"New-ConDepIisWebSite '{0}' {1} {2} {3} '{4}';" , _webSiteName , _id , "@(" + string.Join(",", bindings) + ")" , (string.IsNullOrWhiteSpace(_options.Values.PhysicalPath) ? "$null" : "'" + _options.Values.PhysicalPath + "'") , _options.Values.AppPool) , o => o.WaitIntervalInSeconds(30).RetryAttempts(3)); foreach (var webApp in _options.Values.WebApps) { require.IISWebApp(webApp.Item1, _webSiteName, webApp.Item2); } }
public override void Configure(IOfferRemoteComposition server, IOfferInfrastructure require) { server.ExecuteRemote.PowerShell(string.Format(@"New-ConDepWebApp '{0}' '{1}' {2} {3};" , _webAppName , _webSiteName , (_options == null || string.IsNullOrWhiteSpace(_options.PhysicalPath)) ? "$null" : "'" + _options.PhysicalPath + "'" , (_options == null || string.IsNullOrWhiteSpace(_options.AppPool)) ? "$null" : "'" + _options.AppPool + "'") , psOptions => psOptions.WaitIntervalInSeconds(30)); }
public override void Configure(IOfferRemoteComposition server, IOfferInfrastructure require) { var appPoolOptions = "$appPoolOptions = $null;"; if (_appPoolOptions != null) { appPoolOptions = string.Format("$appPoolOptions = @{{Enable32Bit=${0}; IdentityUsername='******'; IdentityPassword='******'; IdleTimeoutInMinutes={3}; LoadUserProfile=${4}; ManagedPipeline={5}; NetFrameworkVersion={6}; RecycleTimeInMinutes={7}}};" , _appPoolOptions.Enable32Bit.HasValue ? _appPoolOptions.Enable32Bit.Value.ToString() : "false" , _appPoolOptions.IdentityUsername , _appPoolOptions.IdentityPassword , _appPoolOptions.IdleTimeoutInMinutes.HasValue ? _appPoolOptions.IdleTimeoutInMinutes.Value.ToString(CultureInfo.InvariantCulture.NumberFormat) : "$null" , _appPoolOptions.LoadUserProfile.HasValue ? _appPoolOptions.LoadUserProfile.Value.ToString() : "false" , _appPoolOptions.ManagedPipeline.HasValue ? "'" + _appPoolOptions.ManagedPipeline.Value + "'" : "$null" , _appPoolOptions.NetFrameworkVersion == null ? "$null" : ("'" + _appPoolOptions.NetFrameworkVersion + "'") , _appPoolOptions.RecycleTimeInMinutes.HasValue ? _appPoolOptions.RecycleTimeInMinutes.Value.ToString(CultureInfo.InvariantCulture.NumberFormat) : "$null" ); } server.ExecuteRemote.PowerShell(string.Format(@"{0} New-ConDepAppPool '{1}' $appPoolOptions;", appPoolOptions, _appPoolName), psOptions => psOptions.WaitIntervalInSeconds(30)); }
public override void Configure(IOfferRemoteComposition server, IOfferInfrastructure require) { var appPoolOptions = "$appPoolOptions = $null;"; if(_appPoolOptions != null) { appPoolOptions = string.Format("$appPoolOptions = @{{Enable32Bit=${0}; IdentityUsername='******'; IdentityPassword='******'; IdleTimeoutInMinutes={3}; LoadUserProfile=${4}; ManagedPipeline={5}; NetFrameworkVersion={6}; RecycleTimeInMinutes={7}}};" , _appPoolOptions.Enable32Bit.HasValue ? _appPoolOptions.Enable32Bit.Value.ToString() : "false" , _appPoolOptions.IdentityUsername , _appPoolOptions.IdentityPassword , _appPoolOptions.IdleTimeoutInMinutes.HasValue ? _appPoolOptions.IdleTimeoutInMinutes.Value.ToString(CultureInfo.InvariantCulture.NumberFormat) : "$null" , _appPoolOptions.LoadUserProfile.HasValue ? _appPoolOptions.LoadUserProfile.Value.ToString() : "false" , _appPoolOptions.ManagedPipeline.HasValue ? "'" + _appPoolOptions.ManagedPipeline.Value + "'" : "$null" , _appPoolOptions.NetFrameworkVersion == null ? "$null" : ("'" + _appPoolOptions.NetFrameworkVersion +"'") , _appPoolOptions.RecycleTimeInMinutes.HasValue ? _appPoolOptions.RecycleTimeInMinutes.Value.ToString(CultureInfo.InvariantCulture.NumberFormat) : "$null" ); } server.ExecuteRemote.PowerShell(string.Format(@"{0} New-ConDepAppPool '{1}' $appPoolOptions;", appPoolOptions, _appPoolName), psOptions => psOptions.WaitIntervalInSeconds(30)); }
public override void Configure(IOfferRemoteComposition server, IOfferInfrastructure require) { var psCommand = string.Format("Set-Location IIS:\\AppPools; try {{ Remove-WebAppPool '{0}' }} catch {{ }}; $newAppPool = New-WebAppPool '{0}'; ", _appPoolName); if (_appPoolOptions != null) { psCommand += _appPoolOptions.Enable32Bit != null ? string.Format("$newAppPool.enable32BitAppOnWin64 = {0}; ", _appPoolOptions.Enable32Bit.Value ? "$true" : "$false") : ""; psCommand += _appPoolOptions.IdentityUsername != null ? string.Format("$newAppPool.processModel.identityType = 'SpecificUser'; $newAppPool.processModel.username = '******'; $newAppPool.processModel.password = '******'; ", _appPoolOptions.IdentityUsername, _appPoolOptions.IdentityPassword) : ""; psCommand += _appPoolOptions.IdleTimeoutInMinutes != null ? string.Format("$newAppPool.processModel.idleTimeout = [TimeSpan]::FromMinutes({0}); ", _appPoolOptions.IdleTimeoutInMinutes) : ""; psCommand += _appPoolOptions.LoadUserProfile != null ? string.Format("$newAppPool.processModel.loadUserProfile = {0}; ", _appPoolOptions.LoadUserProfile.Value ? "$true" : "$false") : ""; psCommand += _appPoolOptions.ManagedPipeline != null ? string.Format("$newAppPool.managedPipelineMode = '{0}'; ", _appPoolOptions.ManagedPipeline) : ""; psCommand += _appPoolOptions.NetFrameworkVersion != null ? string.Format("$newAppPool.managedRuntimeVersion = '{0}'; ", ExtractNetFrameworkVersion()) : ""; psCommand += _appPoolOptions.RecycleTimeInMinutes != null ? string.Format("$newAppPool.recycling.periodicrestart.time = [TimeSpan]::FromMinutes({0}); ", _appPoolOptions.RecycleTimeInMinutes) : ""; } psCommand += "$newAppPool | set-item;"; string appPoolOptions; if(_appPoolOptions != null) { appPoolOptions = string.Format("$appPoolOptions = @{{Enable32Bit=${0}; IdentityUsername='******'; IdentityPassword='******'; IdleTimeoutInMinutes={3}; LoadUserProfile=${4}; ManagedPipeline={5}; NetFrameworkVersion={6}; RecycleTimeInMinutes={7}}};" , _appPoolOptions.Enable32Bit.HasValue ? _appPoolOptions.Enable32Bit.Value.ToString() : "false" , _appPoolOptions.IdentityUsername , _appPoolOptions.IdentityPassword , _appPoolOptions.IdleTimeoutInMinutes.HasValue ? _appPoolOptions.IdleTimeoutInMinutes.Value.ToString(CultureInfo.InvariantCulture.NumberFormat) : "$null" , _appPoolOptions.LoadUserProfile.HasValue ? _appPoolOptions.LoadUserProfile.Value.ToString() : "false" , _appPoolOptions.ManagedPipeline.HasValue ? "'" + _appPoolOptions.ManagedPipeline.Value + "'" : "$null" , _appPoolOptions.NetFrameworkVersion.HasValue ? "'" + ExtractNetFrameworkVersion() + "'" : "$null" , _appPoolOptions.RecycleTimeInMinutes.HasValue ? _appPoolOptions.RecycleTimeInMinutes.Value.ToString(CultureInfo.InvariantCulture.NumberFormat) : "$null" ); } else { appPoolOptions = "$appPoolOptions = $null;"; } server.ExecuteRemote.PowerShell(string.Format(@"Import-Module $env:temp\ConDepPowerShellScripts\ConDep; {0} New-ConDepAppPool '{1}' $appPoolOptions;", appPoolOptions, _appPoolName), psOptions => psOptions.WaitIntervalInSeconds(30)); }
public override void Configure(IOfferInfrastructure require, ConDepConfig config) { require.IIS(); }
public abstract void Configure(IOfferInfrastructure require, ConDepConfig config);
public override void Configure(IOfferRemoteComposition server, IOfferInfrastructure require) { var removeFeatures = _roleServicesToRemove.Count > 0 ? "$featureRemoved = Remove-WindowsFeature " + string.Join(",", _roleServicesToRemove) : ""; server.ExecuteRemote.PowerShell("Import-Module Servermanager; $feature = Add-WindowsFeature Web-Server,Web-WebServer" + (_roleServicesToAdd.Count > 0 ? "," : "") + string.Join(",", _roleServicesToAdd) + "; $feature; $feature.FeatureResult; " + removeFeatures, opt => opt.WaitIntervalInSeconds(640).RetryAttempts(3)); }
public abstract void Configure(IOfferRemoteComposition server, IOfferInfrastructure require);