Groups | Blog | Home
all groups > inetserver asp components > june 2003 >

inetserver asp components : Application-scoped COM object -> Is there a way to determine when IIS is shutting down?



John Crim
6/29/2003 11:44:01 PM
I want the COM component to hook into some sort of shutdown event, so I can
flush logs and stuff when IIS is shutdown, either by IISReset, "net stop
iisadmin", or the OS shutting down.

It appears that Application-scoped COM objects don't get an OnEndPage method
called when IIS is stopping - should they?

It's possible that I could hook into either IUnknown.Release(), or
DllMain(DLL_PROCESS_DETACH). However, the component is written in C# and
I'm using COM Interop, so it's pretty hairy to hook into the
IUnknown.Release(), and that may occur too late? And I can't hook into
PROCESS_DETACH with managed code, so I'd have to write another DLL in C++
and load it. Either of these approaches are doable but kinda hairy.

Is there an easier approach that anyone's aware of?

Thanks in advance,


John Crim
WebRelevance
john@_remove_this_to_mail_me_webrelevance.com

Adrian Forbes [ASP MVP]
7/2/2003 10:24:40 PM
Use the Application_onEnd event in the global.asa file

[quoted text, click to view]

AddThis Social Bookmark Button