protected override void OnStop() { try { this.mHost.Close(); TimerActivator.Stop(); } catch (Exception e) { mLog.Error(e.ToString()); } }
protected override void OnStart(string[] args) { Task.Run(() => { #if DEBUG while (File.Exists(@"C:\SQLAdmin.Timer.sleep")) { Thread.Sleep(1000); } #endif try { this.mHost = new ServiceHost(typeof(ScheduleService)); this.mHost.Open(); TimerActivator.Start(); } catch (Exception e) { mLog.Error(e.ToString()); } }); }