COM Server Instance Lifetime

Nicolas Koulouris <[email protected]> Tue, 11 Feb 2003 12:35:59 -0500
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <002301c2d1f4$0a7ffaa0$ca44fea9@thebes>
Hello,

I have a COM server (Out-of Process) which implements a COM object to be
used as a SOAP service. The SOAP ISAPI extension (executing in the IIS
process) translates the call as a COM call (using the WSDL definition)
and immediately releases the reference. Of course my server then shuts
down, but I would like to maintain the state in the server, based on a
Connect/Disconnect or Session approach.

First, the COM object that I expose is a COM Singleton. What seems to be the
thing I should do, is to manage the reference count based on the connection
state i.e. I would maintain a bIsConnected indicator and test for its state
when a reference is added or released­. That way I would maintain a count of
either 1 or 0, depending if the client is connecteed or not. This would
ensure the instance lifetime is the same as the connection total length
(provided the client calls Connect/Disconnect in an orderly manner). Of
course this is based on the idea that there is a single client (for a
start). I would then generalize it to a configurable number of clients.

How would I go about overriding or intercept the correct AddRef() and
Release() in ATL to achieve that ? Would that be a bad design approach
provided the stalelessness in the SOAP programming model ?

Nicolas Koulouris


You can read messages from the SOAP archive, unsubscribe from SOAP, or subscribe to other
DevelopMentor lists at http://discuss.develop.com.