示例#1
0
        protected override void OnStart(string[] args)
        {
            bool errorExit = false;

            try
            {
                foreach (IService s in services)
                {
                    StartServiceResult result = s.StartService(base.ServiceHandle);
                    if (false == result.Success)
                    {
                        errorExit = true;
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex, "Exception in OnStart");
                errorExit = true;
            }
            finally
            {
                if (errorExit)
                {
                    ServiceStatusUtil.ErrorExit(log, base.ServiceHandle, ServiceStatusUtil.ERROR_SERVICE_SPECIFIC_ERROR);
                }
            }

            base.OnStart(args);
        }
示例#2
0
        public StartServiceResult StartService(IntPtr serviceHandle)
        {
            var rv = new StartServiceResult();

            if (false == config.HasAppCmd)
            {
                rv.Success = false;
                string msg = Resources.ValidationWinService_AppCmdNotFound_Message;
                log.Error(msg);
                rv.Message = msg;
            }

            return(rv);
        }
        public StartServiceResult StartService(IntPtr serviceHandle)
        {
            var rv = new StartServiceResult();

            if (false == config.HasAppCmd)
            {
                rv.Success = false;
                string msg = Resources.ValidationWinService_AppCmdNotFound_Message;
                log.Error(msg);
                rv.Message = msg;
            }

            return rv;
        }