Need advice on referencing a Managed COM Server (EXE) from Client Application
I have a managed COM out of process server exe in c# exposing my application object model for automation everything is working fine. I can access it from unmanaged code (for example, VC++) and it starts my out of proc server and every works through COM, by using a type library created for my server exe.
When I try and do this from managed code, say a C# client application, I reference my server exe, but it loads the server in-process into the client application.
How can I get it too work from managed code and run has an out of process server in its own process?
What I am trying to do is expose a application object model in COM over my application so it can be automated used by unmanaged code and also managed code, similar to how microsoft office. Everything works fine under unmanaged code through COM, but trying to do the same from Managed code only instantiates my object in-process.
C# Example:
MyApp.Application app = new MyApp.Application();
Would just instantiate the object but I want it too start my out of process COM server as well. A开发者_StackOverflow社区m I missing something here, just wondering if anyone has advice on what to do or where to look.
I found the answer in this article:
regardless of whether the implementation .NET assembly is a Class Library DLL or an executable, this assembly is always loaded in-process into the address space of the client application. And, in the case of an EXE assembly it is neither executed, nor will a running instance of it be used to instantiate the required .NET class....
Some other unorthodox means are required in order to simulate the use of a .NET EXE assembly as an out-of-proc COM Server.
All I can think of is to use Serviced Components hosted in COM+. MSDN Link
精彩评论