Re: ATL COM with IIS6 (auto ExitInstance)
- From: "Brian Muth" <bmuth@xxxxxxxx>
- Date: Tue, 24 Jan 2006 08:29:41 -0800
B.@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FB802D58-F283-4A1A-ADFB-4A9E44BBA164@xxxxxxxxxxxxxxxx
> Hi, I've written (using C++ VS6) a very simple ATL COM used by asp pages.
> The
> COM has a static global variable g_counter of long type; then the COM
> exposes
> an Object Pluto, with a method "Increment_g_Counter" that increments the
> global variable g_counter and a property get_G_Counter that retrieves the
> value of g_counter.
>
> The question is: why, using OS W2k3 and IIS6 (running in iis 5.0 isolation
> mode), after a few minutes, if no clients call the asp page, the g_counter
> values is 0?
The ASP interpreter is certainly free to unload your COM DLL at any time if
there are no clients. This is what is happening.
> IIS6 seems to unload the atl com dll (the ExitInstance Method of the
> CTestasp_comApp is called) after a few minutes; I say "seems" because if I
> try to copy the com dll, the system tells me "the source or the
> destination
> file may be in use".
> I think that this behavior is due to the garbage collector of IIS6.
IIS doesn't have a garbage collector.
No. See my statement above. If there are no clients, your COM DLL will
eventually be unloaded.
>
> I need a behavior like iis5 that keeps COM global variables alive until an
> iisreset command is sent.
>
You are trying to control the lifetime of your COM DLL. The correct approach
would be to use COM+. Make sure your object is marked as free-threaded, and
then install using Component Services. Set the minimum pool size to 1.
Indeed, this completely disconnects the COM object from IIS, and even an
iisreset won't unload the COM+ object. Instead, just shut down the COM+
Application.
Brian
.
- References:
- ATL COM with IIS6 (auto ExitInstance)
- From: Massimo B.
- ATL COM with IIS6 (auto ExitInstance)
- Prev by Date: Detecting when the mouse leaves a region
- Next by Date: Re: beginner Q's about COM/.NET (context = exposing a pre-existing app to scripting)
- Previous by thread: ATL COM with IIS6 (auto ExitInstance)
- Next by thread: Re: ATL COM with IIS6 (auto ExitInstance)
- Index(es):
Relevant Pages
|