Error 1053: The service did not respond to the start or control request in a timely fashion.
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.
- Add an OnPause method to the Service1.vb file.
- Add the following code to the OnStop method and to the OnPause method.
- Add the ServiceProcessInstaller1 installer and the ServiceInstaller1 installer to your SampleWS project.
- In the Properties window of the ServiceProcessInstaller1 installer, set the Account property of the ServiceProcessInstaller1 installer to LocalSystem.
- In the Properties window of the ServiceInstaller1 installer, set the StartType property to Automatic.
- Build the SampleWS application.
- Create a Setup project, and then add the output of the SampleWS application to the Setup project.
- Build the SampleWS solution.
- Locate the Setup1.msi file. This file is located in the Setup1 project folder that was created in step 2.
- Double-click the Setup1.msi file to install the SampleWS Windows service.
- Click Start, click Run, type services.msc in the Open box, and then click OK. The Services Microsoft Management Console (MMC) snap-in opens.
- In the right pane, locate the SampleWS service, and then start the service.
- Stop or pause the SampleWS service.
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
Artikel-id: 839174 - Laatst bijgewerkt: 9 okt. 2011 - Revisie: 1