コード例 #1
0
        /// <summary>
        /// 开始服务
        /// </summary>
        /// <param name="args"></param>
        public void StartService(string[] args)
        {
            logger.Info("Starting service...");

            logger.Info("Bootstrapper...");
            try
            {
                new HostBootstrapper().Startup();
            }
            catch (Exception ex)
            {
                LogHelper.Insert(ex);
                throw;
            }

            logger.Info("Starting HostService...");
            try
            {
                host = new HostNBallService();
                host.Start();
            }
            catch (Exception ex)
            {
                LogHelper.Insert(ex);
                throw;
            }
            logger.Info("HostService is started.");
        }
コード例 #2
0
        public void StartService(string[] args)
        {
            logger.Info("Starting service...");
            AppDomain.CurrentDomain.UnhandledException -= new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            AppDomain.CurrentDomain.ProcessExit        -= new EventHandler(CurrentDomain_ProcessExit);
            AppDomain.CurrentDomain.ProcessExit        += new EventHandler(CurrentDomain_ProcessExit);
            logger.Info("Bootstrapper...");
            try
            {
                new HostBootstrapper().Startup();
            }
            catch (Exception ex)
            {
                LogHelper.Insert(ex);
                throw;
            }

            logger.Info("Starting HostService...");
            try
            {
                host = new HostNBallService();
                host.Start();
            }
            catch (Exception ex)
            {
                LogHelper.Insert(ex);
                throw;
            }
            logger.Info("HostService is started.");
        }