public void VerifyCanOverride() { IFileSystem fileSystem = new FileSystem(); var root = Path.GetPathRoot(AppDomain.CurrentDomain.BaseDirectory); var settings = new DeploymentSettings(root.AppendPath("dev", "test-profile")); IBottleRepository bottles = new BottleRepository(fileSystem, new ZipFileService(fileSystem), settings); var initializer = new WebAppOfflineInitializer(fileSystem); var deployer = new IisWebsiteCreator(); var directive = new Website(); directive.WebsiteName = "fubu"; directive.WebsitePhysicalPath = root.AppendPath("dev", "test-web"); directive.VDir = "bob"; directive.VDirPhysicalPath = root.AppendPath("dev", "test-app"); directive.AppPool = "fubizzle"; directive.DirectoryBrowsing = Activation.Enable; initializer.Execute(directive, new HostManifest("something"), new PackageLog()); deployer.Create(directive); //override test directive.ForceWebsite = true; directive.VDirPhysicalPath = root.AppendPath("dev", "test-app2"); deployer.Create(directive); }
private Site createSite(Website website, ServerManager iisManager) { LogWriter.Current.Highlight("Trying to create a new website at {0}, port {1}", website.WebsitePhysicalPath.ToFullPath(), website.Port); return iisManager.CreateSite(website.WebsiteName, website.WebsitePhysicalPath.ToFullPath(), website.Port, website.ForceWebsite); }
private Application createApp(Website website, Site site) { LogWriter.Current.Highlight("Trying to create a new virtual directory at " + website.VDirPhysicalPath.ToFullPath()); var app = site.CreateApplication(website.VDir, website.VDirPhysicalPath.ToFullPath(), website.ForceApp); app.ApplicationPoolName = website.AppPool; return app; }
private Application createApp(Website website, Site site) { LogWriter.Current.Highlight("Trying to create a new virtual directory '{0}' at '{1}'".ToFormat(website.VDir, website.VDirPhysicalPath.ToFullPath())); new FileSystem().CreateDirectory(website.VDirPhysicalPath.ToFullPath()); var app = site.CreateApplication(website.VDir, website.VDirPhysicalPath.ToFullPath(), website.ForceApp); app.ApplicationPoolName = website.AppPool; return app; }
private Site createSite(Website website, ServerManager iisManager) { LogWriter.Current.Highlight("Trying to create a new website '{0}' at '{1}', port '{2}'", website.WebsiteName, website.WebsitePhysicalPath.ToFullPath(), website.Port); new FileSystem().CreateDirectory(website.WebsitePhysicalPath.ToFullPath()); return iisManager.CreateSite(website.WebsiteName, website.WebsitePhysicalPath.ToFullPath(), website.Port, website.ForceWebsite); }
private static void poolIdentity(Website website, ApplicationPool pool) { if (website.IdentityType.IsEmpty()) return; if (website.HasCredentials()) { pool.ProcessModel.IdentityType = ProcessModelIdentityType.SpecificUser; pool.ProcessModel.UserName = website.Username; pool.ProcessModel.Password = website.Password; return; } var t = (ProcessModelIdentityType) Enum.Parse(typeof (ProcessModelIdentityType), website.IdentityType, true); pool.ProcessModel.IdentityType = t; }
public void Create(Website website) { //currenly only IIS 7 using (var iisManager = new ServerManager()) { var pool = iisManager.CreateAppPool(website.AppPool); pool.ManagedRuntimeVersion = "v4.0"; pool.ManagedPipelineMode = ManagedPipelineMode.Integrated; pool.Enable32BitAppOnWin64 = false; if (website.HasCredentials()) { pool.ProcessModel.UserName = website.Username; pool.ProcessModel.Password = website.Password; } LogWriter.Current.Indent(() => { Site site = createSite(website, iisManager); Application app = createApp(website, site); //flush the changes so that we can now tweak them. iisManager.CommitChanges(); app.DirectoryBrowsing(website.DirectoryBrowsing); // TODO -- just take these out //app.AnonAuthentication(website.AnonAuth); //app.BasicAuthentication(website.BasicAuth); //app.WindowsAuthentication(website.WindowsAuth); iisManager.CommitChanges(); LogWriter.Current.Success("Success."); }); } }
private static TimeSpan convertToTimeSpan(Website website) { var timeout = website.IdleTimeOut; timeout = timeout == 0 ? 20 : timeout; return new TimeSpan(0, 0, timeout, 0); }