windows service c# - error 1053

Asked

Viewed 858 times

0

Create an application Windows service c#, I use a setup project to install the service in windows, when I try to start the service in windows the following error occurs:

error 1053 the service Did not Respond to the start or control request in a Timely fashion

I already created Servicespipetimeout with a longer time in regedit, but did not solve.

My onStart method contains several threads that run throughout the system execution process.

protected override void OnStart(string[] args)
    {
        Thread tEnviarEmailPendente = new Thread(new ThreadStart(this.enviarEmailPendente));
        Thread tBaixarResumoNfe = new Thread(new ThreadStart(baixarResumoNfe));
        Thread tBaixarXmlNfe = new Thread(new ThreadStart(baixarXmlNfe));
        Thread tConsultaSituacaoNfe = new Thread(new ThreadStart(consultaSituacaoNfe));
        Thread tManifestarNfe = new Thread(new ThreadStart(manifestarNFe));
        //Thread tBaixarResumoNfc = new Thread(new ThreadStart(baixarResumoNfc));

        try
        {
            tEnviarEmailPendente.IsBackground = true;
            tBaixarResumoNfe.IsBackground = true;
            tBaixarXmlNfe.IsBackground = true;
            tConsultaSituacaoNfe.IsBackground = true;
            tManifestarNfe.IsBackground = true;
            //tBaixarResumoNfc.IsBackground = true;

            tEnviarEmailPendente.Start();
            tBaixarResumoNfe.Start();
            tBaixarXmlNfe.Start();
            tConsultaSituacaoNfe.Start();
            tManifestarNfe.Start();
            //tBaixarResumoNfc.Start();

            tEnviarEmailPendente.Join();
            tBaixarResumoNfe.Join();
            tBaixarXmlNfe.Join();
            tConsultaSituacaoNfe.Join();
            tManifestarNfe.Join();
        }
        catch (Exception ex)
        {
            erro_log el = new erro_log();
            el.erro_codigo = ex.HResult;
            el.erro_descricao = ex.StackTrace;
            el.servico = "Obter configuracao";
            el.data = DateTime.Now;
            _control.salvarErro(el);
        }
        finally
        {
            wait = false;
        }
    }

1 answer

3


If you used the folder files debug to perform the installation, try to install using the files from the folder release.

(In my case I used Installutil.exe)

Related post.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.