/// <summary> /// 开启服务函数 /// </summary> static void StartService() { MonitorManageService inist = MonitorManageService.Instance(); ServiceHost host = new ServiceHost(inist); inist.SetHost(host); host.Opened += delegate { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); Thread dbConnectionThread = new Thread(new ThreadStart(LoadMonitorTimer_Elapsed)); dbConnectionThread.Start(); logEx.Info("Enter: Start CgwMonitorManage.Service"); }; host.Open(); ServiceBase.Run(inist); }