I've got an ISAPI extension that uses the TerminateExtension call to
clean up any threads I've created before exit. My thread clean-up
routine in TerminateExtension can only complete once all threads
created by my extension have stopped. Because of this, it's important
that TerminateExtension is only called when the web server is shutting
down and is therefore not accepting new requests.

I have ISAPI extension caching set to 'on', so I expect that
TerminateExtension is only called when the web server is stopping.
But from a stack dump, it looks like a large number of threads sitting
in my TerminateExtension function even though my web server is not
shutting down at all.

What I'm wondering is: with ISAPI extension caching on, are there
conditinos other than server shut-down under which TerminateExtension
will be executed? Is there a way to ensure that it only gets called
on shut-down?

I'm not overly experienced with web server administration, so any
insight into this would be appreciated. It may be something as simple
as a configuration parameter.

Thanks,
scott

Re: TerminateExtension called unexpectedly by David

David
Tue Jun 08 01:20:09 CDT 2004

What version of IIS are you referring to?

TerminateExtension is only going to be invoked by IIS when the ISAPI
Extension is getting unloaded, and that happens when IIS is shutting down,
or when the worker process is recycling (i.e. IIS6 Worker Process Isolation
Mode). There won't be any requests being handed to the ISAPI after
TerminateExtension is called.

Does your thread clean-up routine wait for all threads to stop before
cleaning them up in TerminateExtension?

--
//David
IIS
This posting is provided "AS IS" with no warranties, and confers no rights.
//
"Scott Cameron" <scameron24@hotmail.com> wrote in message
news:9a3e4ce1.0406031651.71e47f69@posting.google.com...
I've got an ISAPI extension that uses the TerminateExtension call to
clean up any threads I've created before exit. My thread clean-up
routine in TerminateExtension can only complete once all threads
created by my extension have stopped. Because of this, it's important
that TerminateExtension is only called when the web server is shutting
down and is therefore not accepting new requests.

I have ISAPI extension caching set to 'on', so I expect that
TerminateExtension is only called when the web server is stopping.
But from a stack dump, it looks like a large number of threads sitting
in my TerminateExtension function even though my web server is not
shutting down at all.

What I'm wondering is: with ISAPI extension caching on, are there
conditinos other than server shut-down under which TerminateExtension
will be executed? Is there a way to ensure that it only gets called
on shut-down?

I'm not overly experienced with web server administration, so any
insight into this would be appreciated. It may be something as simple
as a configuration parameter.

Thanks,
scott