SetHost() public method

设置服务运行宿主
public SetHost ( System.ServiceModel.ServiceHost host ) : void
host System.ServiceModel.ServiceHost
return void
Esempio n. 1
0
        /// <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);
        }