Take the 2-minute tour ×

I've written a custom service that overrides ServiceBase.OnShutdown(). Unfortunately, when I log to the event log, nothing is written. My guess is that the Windows event log was shut down before my service. Is there a way to order service shutdown so that my servce shuts down before the event logger? I don't want to have to write out to a file. Pl. advise. Thanks.

share|improve this question
add comment

1 Answer

You could try to setup a dependency where your service depends on the Event logger, this is mostly done to make them load in the correct order but I assume that might make sure that your service always was stopped first as well.
As can be seen in this Technet article, you'd need to change the DependOnService value either using the Sc.exe tool or the ChangeServiceConfig API.

share|improve this answer
fyi - I saw some post somewhere (not very helpful I know) that said this didn't work. –  Rory Aug 11 '10 at 19:45
add comment

Your Answer


