How-to make an EventLog in OnShutdown windows service?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Klaus Unterberg

    How-to make an EventLog in OnShutdown windows service?

    Hello,

    does anyone know, how to make an EventLog in service event OnShutdown?

    It seems that OnShutdown cannot make an entry to the
    eventlog.writee ntry(). Even when Eventlog is listed in the service
    property DependsOn, still not works.

    Any idea? Thank you.

    regards,

    Klaus

    C # / .NET 2.0 / XP Pro SP 3

    protected override void OnShutdown()
    {
    Console.Beep();
    base.OnShutdown ();
    try
    {
    EventLog.WriteE ntry("OnShutdow n"); // exception
    }
    catch { }
    Console.Beep();
    }
Working...