Click here to Skip to main content
11,483,003 members (72,091 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: service Window
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

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 31-Jul-12 2:18am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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!
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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[^]
  Permalink  

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



Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 31 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100