예제 #1
0
파일: Program.cs 프로젝트: xtuyaowu/xparser
        private static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config"));

            ResumeParser parser = new ResumeParser();

            parser.Start();
            Console.ReadKey();
        }
예제 #2
0
        protected override void OnStart(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            try
            {
                IntPtr handle = this.ServiceHandle;
                _serviceStatus.currentState = (int)State.SERVICE_START_PENDING;
                SetServiceStatus(handle, ref _serviceStatus);

                _parser.Start();

                _serviceStatus.currentState = (int)State.SERVICE_RUNNING;
                SetServiceStatus(handle, ref _serviceStatus);

                LoggerWrapper.Logger.Info("XParserService 已经启动");
            }
            catch (Exception ex)
            {
                LoggerWrapper.Logger.Error("XParserService", ex);
            }
        }