11

I am trying to implement an "out of proc" COM server written in C#. How do I do this?

I need the C# code to be "out of proc" from my main C++ application, because I cannot load the .NET runtime into my main process space

WHY?:
My C++ code is in a DLL that is loaded into many different customer EXE's, some of which use different versions of the .NET runtime. Since there can only be one runtime loaded into a single process, my best bet seems to be to put my C# code into another process.

1

4 Answers 4

7

You can create COM+ components using System.EnterpriseServices.ServicedComponent. Consequently, you'll be able to create out-of-proc and in-proc (client) component activation as well as all COM+ benefits of pooling, remoting, run as a windows service etc.

Sign up to request clarification or add additional context in comments.

Comments

1

Here we can read that it is possible, but the exe will be loaded as an library and not started in it's own process like an exe. I don't know if that is a problem for you? It also contains some possible solutions if you do want to make it act like a real out of process com server. But maybe using another way of inter process communication is better. Like .Net Remoting.

Comments

0

I cannot recommend this as the way, but you could create a COM-callable wrapper for your C# library, then create a VB6 ActiveX exe project that delegates calls to your C# library.

Comments

0

Why can't you load the .net runtime into you process space? It is possible to host the .net runtime and call into .net using COM.

1 Comment

My product is a DLL that is used by other companies. They may write their application using various versions of the .NET runtime (or some non .NET tool). Only one version of the .NET runtiem can be loaded into a process at a time, so I want to avoid a separate version of my DLL for each .NET runtime

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.