OnShutdown() not working on XP
- by Daro
I have a service registered for shutdown events (.Net 3.5):
public ServiceName()
{
InitializeComponent();
base.CanHandleSessionChangeEvent = true;
base.CanHandlePowerEvent = true;
base.CanShutdown = true;
}
protected override void OnShutdown()
{
try
{
if (Program.Debug2Eventlog == true)
{
WriteEventEntry(
"Computer is shutting down.",
EventLogEntryType.Information, 0, 3);
}
}
catch
{}
base.OnShutdown();
}
Windows 7 logs the event just fine, but XP doesn't. Am I missing something?