Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

When I am trying to run the service from the task manager,
I am geeting this error

"Error 1053: The service did not respond to the start or control request in a timely fashion"

here is my code on start method

C#
protected override void OnStart(string[] args)
    {
        try
        {
            objTimer.Elapsed += new ElapsedEventHandler(OnElapsedTime);

            //step 2: set interval to 1 week (1 minute= 60,000 milliseconds)
            objTimer.Interval = 60000 * 60 * 24 * 7;

            //step 3: enabling the timer
            objTimer.Enabled = true;
        }
        catch (Exception ex)
        {
            WriteLog(ex); //SROEventLog.WriteEntry("Exception occured in OnStart()" + ex);
        }
    }


Could anyone please help me to fix this issue

Thanks in advance
Sandeep
Posted

As reported by Microsoft, when you stop or pause a managed Microsoft Windows service, and the process of stopping or pausing the service takes more time than the default configured time, you receive the above error.

Following should help:
Microsoft Support: FIX: You receive an "Error 1053: The service did not respond to the start or control request in a timely fashion" error message when you stop or pause a managed Windows service[^]
Microsoft Support: You receive an "Error 1053: The service did not respond to the start or control request in a timely fashion" error[^]

Try!
 
Share this answer
 
You can't run any windows service like any other application. There's some contract between OS and the service exe/dll to run it as 'Service'.

If you are running the service from the task manager for debugging purpose, you have to make some provision for that to work.

I suggest you to go through these links below.


Debugging Windows Service Without Deploying It[^]
Debugging Windows Services under Visual Studio .NET[^]

Simple Windows Service Sample[^]
Creating a Basic Windows Service in C#[^]
A Windows Service Application[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900