Who is responsible for calling CoInitialize and CoUninitialize if
1- I host a COM dll within a surrogate process (either by using dcomcnfg utility or COM+ wizard)?
2- I build a ISAPI DLL that contains COM objects?
Who is responsible for calling CoInitialize and CoUninitialize if
1- I host a COM dll within a surrogate process (either by using dcomcnfg utility or COM+ wizard)?
2- I build a ISAPI DLL that contains COM objects?
No idea on case 2, but in case 1 the surrogate process certainly calls CoInitialize()
/CoUninitialize()
. Here's how I know this.
We have a COM object that we host in COM+ and that itself uses MS XML 4. When you need to create an XML document object in MS XML 4 you call CoCreateInstance()
. We never call CoInitialize()
in our COM object, yet document creation is always successful - certainly the surrogate calls CoInitialize()
. If we do the same in a stand-alone app document creation fails unless we ourself call CoInitialize()
.
So the bottom line is: COM+ surrogate (and I'm sure that applies to DCOM surrogate as well) calls CoInitialize()
itself.
Btw you can use this to investigate the case 2 - call CoCreateInstance()
inside the ISAPI dll - if it is successful CoInitialize()
has already been called.