/// <summary> /// Finish button click. /// </summary> protected void FinishNextButton_Click(object sender, EventArgs e) { if (!separationFinished.ValidateForSeparationFinish()) { string error = String.Empty; if (!AzureHelper.IsRunningOnAzure) { var separationHelper = new DBSeparationHelper(); separationHelper.InstallScriptsFolder = CMSDatabaseHelper.GetSQLInstallPathToObjects(); separationHelper.ScriptsFolder = Server.MapPath("~/App_Data/DBSeparation"); separationHelper.InstallationConnStringSeparate = hdnConnString.Value; error = separationHelper.DeleteSourceTables(separationFinished.DeleteOldDB, false); } if (!String.IsNullOrEmpty(error)) { separationFinished.ErrorLabel.Visible = true; separationFinished.ErrorLabel.Text = error; new EventLogProvider().LogEvent(EventLogProvider.EVENT_TYPE_ERROR, DateTime.Now, "Contact management database join", "DELETEOLDDATA", URLHelper.CurrentURL, error); } else { EnableTasks(); TakeSitesOnline(); WebSyncHelperClass.CreateTask(WebFarmTaskTypeEnum.RestartApplication, "RestartApplication", "", null); ScriptHelper.RegisterStartupScript(this, typeof(string), "Close dialog", ScriptHelper.GetScript("RefreshParent(); CloseDialog();")); } } }
/// <summary> /// Creates web farm server. Called when the "Create server" button is pressed. /// </summary> private bool CreateTask() { // Set the properties string taskTarget = ""; string taskTextData = "MyWebFarmTask"; byte[] taskBinaryData = null; WebFarmTaskTypeEnum webfarmTaskType = WebFarmTaskTypeEnum.ClearHashtables; // Create the web farm task WebSyncHelperClass.CreateTask(webfarmTaskType, taskTarget, taskTextData, taskBinaryData); return(true); }
protected void Page_Load(object sender, EventArgs e) { this.timRefresh.Interval = 1000 * ValidationHelper.GetInteger(this.drpRefresh.SelectedValue, 0); // Check permissions RaiseOnCheckPermissions("READ", this); if (StopProcessing) { return; } // Get values from counters long totalSystemRequests = RequestHelper.TotalSystemPageRequests.GetValue(null); long totalPageRequests = RequestHelper.TotalPageRequests.GetValue(null); long totalPageNotFoundRequests = RequestHelper.TotalPageNotFoundRequests.GetValue(null); long totalNonPageRequests = RequestHelper.TotalNonPageRequests.GetValue(null); long totalGetFileRequests = RequestHelper.TotalGetFileRequests.GetValue(null); // Reevaluate RPS if (mLastRPS != DateTime.MinValue) { double seconds = DateTime.Now.Subtract(mLastRPS).TotalSeconds; if ((seconds < 3) && (seconds > 0)) { mRPSSystemPageRequests = (totalSystemRequests - mLastSystemPageRequests) / seconds; mRPSPageRequests = (totalPageRequests - mLastPageRequests) / seconds; mRPSPageNotFoundRequests = (totalPageNotFoundRequests - mLastPageNotFoundRequests) / seconds; mRPSNonPageRequests = (totalNonPageRequests - mLastNonPageRequests) / seconds; mRPSGetFileRequests = (totalGetFileRequests - mLastGetFileRequests) / seconds; } else { mRPSGetFileRequests = -1; mRPSNonPageRequests = -1; mRPSPageNotFoundRequests = -1; mRPSPageRequests = -1; mRPSSystemPageRequests = -1; } } mLastRPS = DateTime.Now; // Update last values mLastGetFileRequests = totalGetFileRequests; mLastNonPageRequests = totalNonPageRequests; mLastPageNotFoundRequests = totalPageNotFoundRequests; mLastPageRequests = totalPageRequests; mLastSystemPageRequests = totalSystemRequests; // Do not count this page with async postback if (RequestHelper.IsAsyncPostback()) { RequestHelper.TotalSystemPageRequests.Decrement(null); } pnlSystemInfo.GroupingText = GetString("Administration-System.SystemInfo"); pnlSystemTime.GroupingText = GetString("Administration-System.SystemTimeInfo"); pnlDatabaseInfo.GroupingText = GetString("Administration-System.DatabaseInfo"); lblServerName.Text = GetString("Administration-System.ServerName"); lblServerVersion.Text = GetString("Administration-System.ServerVersion"); lblDBName.Text = GetString("Administration-System.DatabaseName"); lblDBSize.Text = GetString("Administration-System.DatabaseSize"); lblMachineName.Text = GetString("Administration-System.MachineName"); lblMachineNameValue.Text = HTTPHelper.MachineName; lblAspAccount.Text = GetString("Administration-System.Account"); lblValueAspAccount.Text = System.Security.Principal.WindowsIdentity.GetCurrent().Name; // Get application pool name lblPool.Text = GetString("Administration-System.Pool"); lblValuePool.Text = GetString("General.NA"); try { lblValuePool.Text = SystemHelper.GetApplicationPoolName(); } catch { } // Get application trust level lblTrustLevel.Text = GetString("Administration-System.TrustLevel"); lblValueTrustLevel.Text = GetString("General.NA"); try { lblValueTrustLevel.Text = SystemHelper.CurrentTrustLevel.ToString(); } catch { } lblAspVersion.Text = GetString("Administration-System.Version"); lblValueAspVersion.Text = System.Environment.Version.ToString(); pnlMemory.GroupingText = GetString("Administration-System.MemoryStatistics"); lblAlocatedMemory.Text = GetString("Administration-System.Memory"); lblPeakMemory.Text = GetString("Administration-System.PeakMemory"); lblVirtualMemory.Text = GetString("Administration-System.VirtualMemory"); lblPhysicalMemory.Text = GetString("Administration-System.PhysicalMemory"); lblIP.Text = GetString("Administration-System.IP"); pnlPageViews.GroupingText = GetString("Administration-System.PageViews"); lblPageViewsValues.Text = GetString("Administration-System.PageViewsValues"); lblPages.Text = GetString("Administration-System.Pages"); lblSystemPages.Text = GetString("Administration-System.SystemPages"); lblNonPages.Text = GetString("Administration-System.NonPages"); lblGetFilePages.Text = GetString("Administration-System.GetFilePages"); lblPagesNotFound.Text = GetString("Administration-System.PagesNotFound"); lblPending.Text = GetString("Administration-System.Pending"); pnlCache.GroupingText = GetString("Administration-System.CacheStatistics"); lblCacheExpired.Text = GetString("Administration-System.CacheExpired"); lblCacheRemoved.Text = GetString("Administration-System.CacheRemoved"); lblCacheUnderused.Text = GetString("Administration-System.CacheUnderused"); lblCacheItems.Text = GetString("Administration-System.CacheItems"); lblCacheDependency.Text = GetString("Administration-System.CacheDependency"); pnlGC.GroupingText = GetString("Administration-System.GC"); btnClear.Text = GetString("Administration-System.btnClear"); btnClearCache.Text = GetString("Administration-System.btnClearCache"); btnRestart.Text = GetString("Administration-System.btnRestart"); btnRestartWebfarm.Text = GetString("Administration-System.btnRestartWebfarm"); btnClearCounters.Text = GetString("Administration-System.btnClearCounters"); btnRestartServices.Text = GetString("Administration-System.btnRestartServices"); // Hide button if wefarms are not enabled or disallow restarting webfarms for Windows Azure if (!WebSyncHelperClass.WebFarmEnabled || AzureHelper.IsRunningOnAzure) { this.btnRestartWebfarm.Visible = false; } // Hide the web farm restart button if this web farm server is not enabled if (!RequestHelper.IsPostBack()) { WebFarmServerInfo webFarmServerObj = WebFarmServerInfoProvider.GetWebFarmServerInfo(WebSyncHelperClass.ServerName); if ((webFarmServerObj != null) && (!webFarmServerObj.ServerEnabled)) { this.btnRestartWebfarm.Visible = false; } } // Hide restart service button if services folder doesn't exist this.btnRestartServices.Visible = SystemHelper.IsFullTrustLevel && WinServiceHelper.ServicesAvailable(); // Hide the performance counters clear button if the health monitoring is not enabled or feature is not available this.btnClearCounters.Visible = SystemHelper.IsFullTrustLevel && LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.HealthMonitoring); LoadData(); if (!RequestHelper.IsPostBack()) { switch (QueryHelper.GetString("lastaction", String.Empty).ToLower()) { case "restarted": lblInfo.Text = GetString("Administration-System.RestartSuccess"); break; case "webfarmrestarted": if (ValidationHelper.ValidateHash("WebfarmRestarted", QueryHelper.GetString("restartedhash", String.Empty))) { lblInfo.Text = GetString("Administration-System.WebframRestarted"); // Restart other servers - create webfarm task for application restart WebSyncHelperClass.CreateTask(WebFarmTaskTypeEnum.RestartApplication, "RestartApplication", "", null); } else { lblInfo.Text = GetString("general.actiondenied"); } break; case "countercleared": lblInfo.Text = GetString("Administration-System.CountersCleared"); break; case "winservicesrestarted": lblInfo.Text = GetString("Administration-System.WinServicesRestarted"); break; } } lblRunTime.Text = GetString("Administration.System.RunTime"); lblServerTime.Text = GetString("Administration.System.ServerTime"); // Remove miliseconds from the end of the time string string timeSpan = (DateTime.Now - CMSAppBase.ApplicationStart).ToString(); int index = timeSpan.LastIndexOf('.'); if (index >= 0) { timeSpan = timeSpan.Remove(index); } // Display application run time lblRunTimeValue.Text = timeSpan; lblServerTimeValue.Text = Convert.ToString(DateTime.Now) + " " + TimeZoneHelper.GetGMTStringOffset(TimeZoneHelper.ServerTimeZone); lblIPValue.Text = Request.UserHostAddress; }