protected override void OnStart(string[] args) { try { base.OnStart(args); m_HostKeeper = m_HostKeeperCreator(); m_HostKeeper.Open(); m_Trace.TraceInfo(TraceTitle, "Reports Service Started."); } catch (Exception ex) { m_Trace.TraceCritical(ex); throw; } }
public void RunInConsole() { try { using (ServiceHostKeeper hostKeeper = m_HostKeeperCreator()) { //throw new ApplicationException("xxx"); hostKeeper.Open(); m_Trace.TraceInfo(TraceTitle, @"Press Enter to stop Service."); Console.ReadLine(); } } catch (Exception ex) { m_Trace.TraceError(ex); Console.ReadLine(); } }