简体   繁体   中英

Unable to run V C++ application as a service. Getting “The service did not respond to the start or control request in a timely fashion. ” error

I am working on migration of an VC++ application from VS 2003 to VS 2010. After migration, an exe which has to be called through a service is not running. It throws the following error messages in the event viewer.

Timeout (30000 milliseconds) waiting for the MyService service to connect.

The MyService service failed to start due to the following error: The service did not respond to the start or control request in a timely fashion.

I created the service to call this exe using sc.exe in command prompt. Service creation says successful. But, when I start the service, within one or two seconds it throws the above error and stops.

Could someone help me on this? Am I overlookng anything? Please it would be of great help if someone can help me out on this.

Thanks,

You cannot just "create a service" by using "sc.exe" and a regular .exe file. Services run special code that talks to the Windows Service Manager.

Check out http://msdn.microsoft.com/en-us/library/windows/desktop/ms685969(v=vs.85).aspx and http://www.codeproject.com/Articles/2676/How-to-Create-a-Windows-NT-Windows-2000-Service for the details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM