none
[E2007 and later] [TA] [C#]: How can you tell if the Microsoft Exchange Transport service is shutting down ? RRS feed

  • Question

  • Hi,

    Looking at routing agents under E2007 and E2010 with C# ...

    How can you tell if the Microsoft Exchange Transport service (which hosts the agent DLLs) is closing?

    The routing agent factory has a Close() member function that is called just before the agent unloads but there doesn't seem to be any way to detect the intention of the service to stop.

    I have several threads running (that may be blocking sometimes) and the Close() function isn't called while events are still being processed (so in the case of a blocked thread it's never called - the service controller kills the service in the end). I'd like some notification the service is about to stop so that I could terminate my agent's threads nicely and allow the agent to close cleanly.

    The only way I can think to do this is to subscribe to the application event log for MSExchange Transport service event 1002 (the service is trying to stop).

    Is there a better way to do this ???

    Thanks,

    J. Kahl.

     

     


    Wednesday, April 6, 2011 4:44 AM