none
Windows Service wait for xxx Services Connection Timeout RRS feed

  • Question

  • Seek advice: encountered problems in the work, Windows service occasionally encountered the problem of startup timeout when starting up, check the code should not appear such as error, attached system version and startup code

    codeSystem version: Win7 SP1 (6.1.7601) x64

    Compiled using: Win7 SP1 (6.1.7601) x86

    Compilation tool: VS2015 enterprise edition

        // 启动代码
        protected override void OnStart(string[] args)
        {
            // TODO: 在此处添加代码以启动服务。
            try
            {
                HttpThread _httpThread = new HttpThread();
                ThreadPool.QueueUserWorkItem(h => _httpThread.OnStart());
                //base.AutoLog = true;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    
    
        class HttpThread
        {
            public void OnStart()
            {
                HSUserEventManager.Instance.Init();
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                _running = true;
                _thread = new Thread(new ThreadStart(DoIt));
                _thread.IsBackground = true;
                _thread.Start();
            }
        }

    Friday, January 3, 2020 6:24 AM

All replies

  • Hi 吴彤,

    Thank you for posting here.

    For your question, you can try to increase window service timeout.

    Check the following reference:

    Need to increase window service timeout

    Besides, if the reference is not helpful, please provide some related code about 'HSUserEventManager' and 'DoIt', it will help us analyze and reproduce your problem.

    Best Regards,

    Xingyu Zao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 3, 2020 9:57 AM
    Moderator