Re: ATL COM with IIS6 (auto ExitInstance)



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


.



Relevant Pages

  • Re: can i load my own dlls into services.exe, if how
    ... ISAPI extensions and ISAPI filters can be useful. ... > DLL via JScript 'new ActiveXObject' or the VBscript equivalent in your ASP ...
    (microsoft.public.windowsce.app.development)
  • ASP / ASP.NET
    ... Ich habe folgendes Vorgehen mit ASP erfolgreich getestet: ... Eine Active-X DLL übernimmt die Abfrage der ... (hat nichts mit dem Request aus ASP zu tun). ... es ist effizient und recht schnell weil die Abfrage der Datenbank ...
    (microsoft.public.de.german.entwickler.dotnet.asp)
  • Re: Dynamically Created AX Control not released.
    ... every dll loaded in a process must be explicitly ... For COM dll's (like OCX) the dll is loaded in a compatible apartment (STA ... yourself, by calling "CoLoadLibrary", and unload it when done by calling ... > protected override void Dispose(bool disposing) ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Any tool that tells COM dependencies of a DLL?
    ... Actually that's what Igor was trying to tell you - the DLL never ... client does a single cocreate, ... one can unload them explicitly by calling ...
    (microsoft.public.win32.programmer.ole)
  • Re: Any tool that tells COM dependencies of a DLL?
    ... i see the shell load my ... i don't see the DLL get loaded and held onto... ... the client does a single cocreate, ... one can unload them explicitly by calling ...
    (microsoft.public.win32.programmer.ole)