/// <summary/> /// <exclude/> /// <devdoc> /// The windows service start event. /// </devdoc> protected override void OnStart(string[] args) { if (!initializeComponentsCalled) { InitializeComponent(); } try { SanityCheck sanityCheck = new SanityCheck(this); sanityCheck.StartCheckTimer(); if (this.Status == ServiceStatus.OK) { StartMsmqListener(); this.eventLogger.LogServiceStarted(); } } catch (Exception e) { this.eventLogger.LogServiceFailure( string.Format(Resources.Culture, Resources.ServiceStartError, this.ApplicationName), e, TraceEventType.Error); this.Status = ServiceStatus.Shutdown; } }
/// <summary/> /// <exclude/> /// <devdoc> /// The windows service start event. /// </devdoc> protected override void OnStart(string[] args) { try { SanityCheck sanityCheck = new SanityCheck(this); sanityCheck.StartCheckTimer(); if (this.Status == ServiceStatus.OK) { StartMsmqListener(); this.eventLogger.AddMessage(Header, SR.ServiceStartComplete(this.ApplicationName)); LoggingDistributorEvent.Fire(this.eventLogger.GetMessage(null), true); this.eventLogger.WriteToLog(null, Severity.Information); } } catch (Exception e) { this.eventLogger.AddMessage(Header, SR.ServiceStartError(this.ApplicationName)); this.eventLogger.WriteToLog(e, Severity.Error); this.Status = ServiceStatus.Shutdown; } catch { this.Status = ServiceStatus.Shutdown; } }