public virtual Site GetSite([NotNull] WebServerManager.WebServerContext context) { Assert.ArgumentNotNull(context, "context"); Site site = context.Sites.SingleOrDefault(s => s.Id == this.ID); Assert.IsNotNull(site, "Website " + this.ID + " not found"); return(site); }
public virtual void StopApplicationPool() { Log.Info($"Stop app pool {Name} ({ID})"); using (WebServerManager.WebServerContext context = WebServerManager.CreateContext()) { ApplicationPool pool = GetPool(context); if (IsStarted(pool)) { pool.Stop(); context.CommitChanges(); } } }
public virtual void Recycle() { Log.Info($"Recycle the {Name} instance's application pool"); using (WebServerManager.WebServerContext context = WebServerManager.CreateContext()) { ApplicationPool pool = GetPool(context); if (IsStarted(pool)) { pool.Recycle(); context.CommitChanges(); } } }
public virtual void StopApplicationPool() { Log.Info("Stop app pool {0} ({1})", this.Name, this.ID); using (WebServerManager.WebServerContext context = WebServerManager.CreateContext("Website.StopApplicationPool")) { ApplicationPool pool = this.GetPool(context); if (this.IsStarted(pool)) { pool.Stop(); context.CommitChanges(); } } }
public virtual void Recycle() { Log.Info("Recycle the {0} instance's application pool", this.Name); using (WebServerManager.WebServerContext context = WebServerManager.CreateContext("Website.Recycle")) { ApplicationPool pool = this.GetPool(context); if (this.IsStarted(pool)) { pool.Recycle(); context.CommitChanges(); } } }
public virtual ApplicationPool GetPool([NotNull] WebServerManager.WebServerContext context) { Assert.ArgumentNotNull(context, nameof(context)); var site = GetSite(context); var application = site.Applications.FirstOrDefault(ap => ap.Path.EqualsIgnoreCase("/")); Assert.IsNotNull(application, $"Cannot find root application for {site.Name} site"); var poolname = application.ApplicationPoolName; ApplicationPool pool = context.ApplicationPools[poolname]; Assert.IsNotNull(pool, $"The {poolname}application pool doesn\'t exists"); return(pool); }
public virtual ApplicationPool GetPool([NotNull] WebServerManager.WebServerContext context) { Assert.ArgumentNotNull(context, "context"); var site = this.GetSite(context); var application = site.Applications.FirstOrDefault(ap => ap.Path.EqualsIgnoreCase("/")); Assert.IsNotNull(application, "Cannot find root application for {0} site".FormatWith(site.Name)); string poolname = application.ApplicationPoolName; ApplicationPool pool = context.ApplicationPools[poolname]; Assert.IsNotNull(pool, "The " + poolname + "application pool doesn't exists"); return(pool); }
public virtual void SetAppPoolMode(bool?is40 = null, bool?is32 = null) { using (WebServerManager.WebServerContext context = WebServerManager.CreateContext()) { ApplicationPool pool = GetPool(context); if (is32 != null) { pool.Enable32BitAppOnWin64 = (bool)is32; } if (is40 != null) { pool.SetAttributeValue("managedRuntimeVersion", (bool)is40 ? "v4.0" : "v2.0"); } context.CommitChanges(); } }
public virtual string GetName(WebServerManager.WebServerContext context) { return(GetSite(context).Name); }