protected void imagePlay_Click(object sender, ImageClickEventArgs e) { if (PreWarmUp.Started == DateTime.MinValue) { System.Security.Principal.WindowsImpersonationContext impersonationContext; impersonationContext = ((System.Security.Principal.WindowsIdentity)HttpContext.Current.User.Identity).Impersonate(); IISHelpers.SetAutoStartProvider(); IISHelpers.SetAutoStart(HttpContext.Current.Request.ApplicationPath, true); impersonationContext.Undo(); Thread.Sleep(1000); // allow IIS to warmup. Response.Redirect("./"); return; } this.ServiceState = EnumServiceState.Started; if (OnChangeServiceState != null) { OnChangeServiceState(this, e); } }
protected void imageStop_Click(object sender, ImageClickEventArgs e) { System.Security.Principal.WindowsImpersonationContext impersonationContext; impersonationContext = ((System.Security.Principal.WindowsIdentity)HttpContext.Current.User.Identity).Impersonate(); IISHelpers.SetAutoStartProvider(); IISHelpers.SetAutoStart(HttpContext.Current.Request.ApplicationPath, false); impersonationContext.Undo(); Thread.Sleep(1000); // allow the application host to reset. Response.Redirect("./"); //this.ServiceState = EnumServiceState.Stopped; //if (OnChangeServiceState != null) //{ // OnChangeServiceState(this, e); //} }
public void GetSiteTest() { IISHelpers.SetAutoStartProvider(); IISHelpers.SetAutoStart("/IISProcessScheduler", true); }