Microsoft KB Archive/839174

= FIX: You receive an &quot;Error 1053: The service did not respond to the start or control request in a timely fashion&quot; error message when you stop or pause a managed Windows service =

Article ID: 839174

Article Last Modified on 3/29/2007

-

APPLIES TO


 * Microsoft .NET Framework 1.1

-





SYMPTOMS
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 following error message:

Could not stop the  service on Local Computer.

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

Note  is a placeholder for the name of the Windows service that you have created.



CAUSE
The ServiceBase class calls the OnStop method directly from the Service command handler that is defined in the ScDispatcherLoop of the Advapi32.dll file. After 30 seconds, if the ScDispatcherLoop thread is not ready to receive a new service command from the service control manager, Windows Service Controller marks the service as &quot;time out.&quot; Therefore, you receive this error message.



RESOLUTION
To resolve this problem, obtain the latest service pack for the Microsoft .NET Framework 1.1. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

885055 How to obtain Microsoft .NET Framework 1.1 Service Pack 1



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section. This problem was first corrected in Microsoft .NET Framework 1.1 Service Pack 1.



Steps to reproduce the behavior
 Create a Windows Service project. To do this, follow these steps:  Use Microsoft Visual Basic .NET to create a Windows Service project. Name the Windows service SampleWS. In the Properties window of SampleWS, set the CanPauseAndContinue property, the CanShutDown property, and the CanStop property to True. Set the ServiceName property to SampleWS.  In the code view of the Service1.vb file, add the following code at the beginning of the file to import the System.Threading namespace into the project. Imports System.Threading </li> Add an OnPause method to the Service1.vb file.</li>  Add the following code to the OnStop method and to the OnPause method. Thread.Sleep(40000) </li> Add the ServiceProcessInstaller1 installer and the ServiceInstaller1 installer to your SampleWS project.</li> In the Properties window of the ServiceProcessInstaller1 installer, set the Account property of the ServiceProcessInstaller1 installer to LocalSystem.</li> In the Properties window of the ServiceInstaller1 installer, set the StartType property to Automatic.</li> Build the SampleWS application.</li></ol> </li> Create a Setup project, and then add the output of the SampleWS application to the Setup project.</li> Build the SampleWS solution.</li> Locate the Setup1.msi file. This file is located in the Setup1 project folder that was created in step 2.</li> Double-click the Setup1.msi file to install the SampleWS Windows service.</li> Click Start, click Run, type services.msc in the Open box, and then click OK. The Services Microsoft Management Console (MMC) snap-in opens.</li> In the right pane, locate the SampleWS service, and then start the service.</li> Stop or pause the SampleWS service.</li></ol>

You notice the problem that is mentioned in the “Symptoms” section.

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

824684Description of the standard terminology that is used to describe Microsoft software updates

<div class="references_section">