Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to access a .Net COM object hosted in a COM+ Server in .Net?
    text
    copied!<p>This question is a follow-up to the answer given by Marc Gravell to my question <a href="https://stackoverflow.com/questions/446417/create-out-of-process-com-in-c-net">Create Out-Of-Process COM in C#/.Net ?</a>. I have chosen his proposed solution, but now am running in a different issue.</p> <p>Here is my situation:</p> <ul> <li>I implemented a "DataProvider" COM component in C#</li> <li>This component is hosted in a COM+ Server application so that multiple processes can access the same instance of the DataProvider</li> <li>The types of processes that can access the data provider through COM are Matlab, VB Scripts and .Net applications.</li> </ul> <p>When instantiating the COM DataProvider from Matlab or VB Script, the COM+ mechanism kicks in and I can verify that a single instance of the DataProvider can be used.</p> <p>The problem comes when I try to access the COM+ managed instance from .Net. Basically, when a COM component is based on a .Net DLL, even with lazy loading, .Net always seems to find the DLL and instantiate the object from there, skipping the whole COM mechanism. This is expected for performances, but it does not help in my case.</p> <p>Now for the question: Is it possible to instantiate a .Net written COM component in a .Net application <strong>using the COM mechanism?</strong></p> <p>Note that the following code does not use the COM mechanism:</p> <pre><code> Type type = Type.GetTypeFromProgID(progID); return Activator.CreateInstance(type); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload