static void Main(string[] args) { SmcErr smcErr = new SmcErr(); NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); try { logEx.Info("Enter: Start Cgw Service"); CgwServiceInit cgwService = new CgwServiceInit(); smcErr = CgwService.Instance().InitService(); if (smcErr.IsSuccess()) { cgwService.InitServiceInfo(); string LocalServiceStartMode = CommonFunction.GetAppSetting("LocalServiceStartMode"); if (string.IsNullOrEmpty(LocalServiceStartMode)) { LocalServiceStartMode = "1"; } CgwService.Instance().LicenseInit(); Thread dbConnectionThread = new Thread(new ThreadStart(LoadMonitorTimer_Elapsed)); dbConnectionThread.Start(); ServiceRun.StarUpService(LocalServiceStartMode, "HUAWEI SMC 2.0 ConvergeGateway", cgwService); //logEx.Info("CGW service Start Successful!"); } else { logEx.Error("CGW service Start failed! Errno :{0}", smcErr.ErrNo); NLog.LogManager.Flush(); System.Diagnostics.Process.GetCurrentProcess().Kill(); } } catch (System.Exception e) { logEx.Fatal(e, "CGW service Start Failed!"); NLog.LogManager.Flush(); } }