Create a Windows service C # application, I use a setup project to do the service installation on windows, when I try to start the service on windows the following error occurs:
error 1053 the service did not respond to the start or control request in a timely fashion
I've already created ServicesPipeTimeout with a longer time in regedit, but it did not work.
My onStart method contains several threads that will 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;
}
}