Question

How do you register a COM object written in Managed C++ to be SingleUse? Regasm does not appear to have the option. I am guessing it may be a s simple as defining an attribute in AssemblyInfo.cpp but I can't find it.

I have written a VB6 ActiveX EXE and it works as I want it to - that is every request for an Interface creates a new running Server.

Do I have to resort to wrapping my Managed C++ COM in VB6? There has to be an easier way.

Was it helpful?

Solution

It looks like Serviced Components holds the key to my problem.

http://oreilly.com/catalog/comdotnetsvs/chapter/ch10.html

Once I derive from ServicedComponent in the System.EnterpriseServices namespace, do a regsvcs on the dll and then change the pooling in dcomcnfg to be greater than one - it all works. Another issue is to have the Managed C++ component being regsistered compiled with /clr:pure not just /clr. I have yet to complete the project but sample projects I built on the way indicate it should work this way. I think I will wrap my Managed C++ solution in a C# assembly...

Now that i have nearly finished the project one more thing...You need to be on a Server O\S to get the pooling to work.

Thanks for your guidance...

OTHER TIPS

How to use single or multiple instances of an OLE object in MFC by using Visual C++

http://support.microsoft.com/kb/141154

This might give you some clues:

Using Managed Controls as ActiveX Controls
http://blogs.msdn.com/andreww/archive/2008/11/24/using-managed-controls-as-activex-controls.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top