Generally, after you have written a windows Service Program, run the SC create command to create the service and start it. However, sometimes the service cannot be started normally. The following are two cases and corresponding solutions:
1. When starting the service, the system prompts "error 1053: the service did not start or control the request in time ".
2. When starting the service, the system error 14001 is displayed. The application fails to start because the application configuration is incorrect ......".
For Error 1, it is often because the dll required by some services is missing. The solution is as follows. Find the directory where the service program is located, such as D: \ services \. Double-click the service program. A prompt box is displayed, prompting that a dll is missing during service running, then you can find the dll elsewhere and put it in the same directory as this service or the C: \ windows \ system32 directory. This problem can be solved.
For Error 2, it is often because the service program you write is written using the VC compiler and runs on a machine, the runtime components of the Visual C ++ library must be installed on this machine. If you are using a program written in Visual Studio2005, you need to install Microsoft Visual C ++ 2005 SP1 Redistributable Package (x86). If you are using a service program written in Visual Studio2008, then you need to install Microsoft Visual C ++ 2008 SP1 Redistributable Package (x86). If you are using a service program written in Visual Studio 2010, then you need to install the Microsoft Visual C ++ 2010 component package (x86 ). The official download websites for the three package are:
Http://www.microsoft.com/downloads/zh-cn/details.aspx? Displaylang = zh-cn & FamilyID = 200b2fd9-ae1a-4a14-984d-389c36f85647
Http://www.microsoft.com/downloads/zh-cn/details.aspx? Displaylang = zh-cn & FamilyID = a5c84275-3b97-4ab7-a40d-3802b2af5fc2
Http://www.microsoft.com/downloads/zh-cn/details.aspx? Displaylang = zh-cn & FamilyID = a7b7a05e-6de6-4d3a-a423-37bf0912db84
If you encounter other situations, I will promptly add this article.
Another csdn blog introduces how to handle Service Startup errors. It can be used as a reference:
Troubleshooting of five common Windows Service Startup problems: http://www.bkjia.com/ OS /201201/115922.html