示例#1
0
 protected override void OnStart(string[] args)
 {
     try
     {
         serviceHost = new Service.ServiceMonitor();
         try
         {
             if (serviceHost != null)
             {
                 serviceHost.Start();
                 SeatManage.SeatManageComm.WriteLog.Write(string.Format("“{0}”已启动", serviceHost.ToString()));
             }
             else
             {
                 SeatManage.SeatManageComm.WriteLog.Write(string.Format("“{0}”启动失败,服务初始化失败", serviceHost.ToString()));
             }
         }
         catch (Exception ex)
         {
             SeatManage.SeatManageComm.WriteLog.Write(string.Format("“{0}”启动遇到异常:{1}", serviceHost.ToString(), ex.Message));
         }
     }
     catch (Exception ex)
     {
         SeatManage.SeatManageComm.WriteLog.Write(string.Format("ServiceHost启动遇到异常:{0}", ex.Message));
     }
 }
 protected override void OnStart(string[] args)
 {
     try
     {
         serviceHost = new Service.FileService();
         try
         {
             serviceHost.Start(); SeatManage.SeatManageComm.WriteLog.Write(string.Format("“{0}”已启动", serviceHost.ToString()));
         }
         catch (Exception ex)
         {
             SeatManage.SeatManageComm.WriteLog.Write(string.Format("“{0}”启动遇到异常:{1}", serviceHost.ToString(), ex.Message));
         }
     }
     catch (Exception ex)
     {
         SeatManage.SeatManageComm.WriteLog.Write(string.Format("ServiceHost启动遇到异常:{0}", ex.Message));
     }
 }