Error 1053 service did not respond to start or control request in a timely manner

Asked

Viewed 1,059 times

0

Hello! I did a windows sending and mailing service, but am getting error 1053 while trying to start it. I looked at several articles and forums and could not solve the problem. Could anyone explain to me what could be? Follow the code.

Servico.Cs

    public partial class EnvioEmailAutomatico : ServiceBase
{
    private int eventId = 1;
    private System.Diagnostics.EventLog eventLog1;

    public EnvioEmailAutomatico()
    {
        InitializeComponent();

        eventLog1 = new System.Diagnostics.EventLog();

        if (!System.Diagnostics.EventLog.SourceExists("MySource"))
        {
            System.Diagnostics.EventLog.CreateEventSource(
                "MySource", "MyNewLog");
        }
        eventLog1.Source = "MySource";
        eventLog1.Log = "MyNewLog";
    }

    protected override void OnStart(string[] args)
    {
        System.Diagnostics.Debugger.Launch();
        Timer timer = new Timer();
        timer.Interval = 300000; // 5 Minutos
        timer.Enabled = true;
        timer.Elapsed += new System.Timers.ElapsedEventHandler(this.OnTimer);
        timer.Start();
    }

    protected override void OnStop()
    {
        eventLog1.WriteEntry("Serviço de Envio de E-mail Automático Encerrado.");
    }

    public void OnTimer(object sender, System.Timers.ElapsedEventArgs args)
    {
        eventLog1.WriteEntry("Monitorando os E-mails Agendados", EventLogEntryType.Information, eventId++);
    }

Main.Cs

    public static class EnvioEmail
{
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    public static void Main()
    {
            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new EnvioEmailAutomatico()
            };
            ServiceBase.Run(ServicesToRun);
    }
}
  • I haven’t seen anything related to sending email in your code, you haven’t implemented that part yet? Error happens when debugging or starting the service in windows?

  • I pulled the part about the e-mail. I made a service exactly like this in the code and tried to run, but it displays the same error 1053 when initializing it.

  • On the local machine the service runs, not on the server

  • Hmmm, did you verify that the account for the execution of the service has the necessary privilege? Error 1053 may also be related to firewall, but this would only make sense if the version you are posting to the server is trying to connect to smpt in another environment.

  • I tested with user administrator, local, my... It didn’t work. I got it. I talked to the people from the infra and they will restart the server

No answers

Browser other questions tagged

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