Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Services Recovery not restarting service

Tags:

I configure the recovery for Windows services to restart with a one minute delay after failures. But I have never gotten it to actually restart the service (even with the most blatant errors).

I do get a message in the EventViewer:

The description for Event ID ( 1 ) in Source ( MyApp.exe ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Access violation at address 00429874 in module 'MyApp.exe'. Write of address 00456704.

Is there something else I have to do? Is there something in my code (I use Delphi) which needs to be set to enable this?

like image 338
M Schenkel Avatar asked Nov 19 '09 15:11

M Schenkel


People also ask

Why service is not starting automatically?

If your service StartType is set to Automatic, but the service is not running after a reboot, then either your service has a dependency on another service that is not starting correctly, or your service's own startup code is failing and ends up stopping the service.


2 Answers

Service Recovery is intended to handle the case where a service crashes - so if you go to taskmgr and right click "end process" on your service process, the recovery logic should kick in. I don't believe that the service recovery logic kicks in if your service exits gracefully (even if it exits with an error).

Also the eventvwr message indicates that your application called the ReportEvent API specifying event ID 1. But you haven't registered your event messages with the event viewer so it can't convert event ID 1 into a meaningful text string.

like image 179
ReinstateMonica Larry Osterman Avatar answered Nov 09 '22 06:11

ReinstateMonica Larry Osterman


Service Recovery only works for unexpected exit like (exit(-1)) call. For all the way we use to stop the service in usual way will not works for recovery. If you want to stop service and still wants recovery to work, call exit(-1) and you will see error message as "service stopped with unexpected error" , and then your service will restart as recovery setting is.

like image 20
suprit chaudhary Avatar answered Nov 09 '22 05:11

suprit chaudhary