COM+ object activation in a different partition

C#ComMultiple InstancesActivationMoniker

C# Problem Overview


I had created a COM+ domain partition then mapped it to a Windows 2008 server machine and imported a COM+ application into it.

I tried using the following C# code to activate an object from that specific partition on the server remotely:

//partition guid
Guid guidMyPartition = new Guid("41E90F3E-56C1-4633-81C3-6E8BAC8BDD70");
//parition moniker
string uri= "partition:{" + guidMyPartition + "}/new:MyObject";
Type t = Type.GetTypeFromProgID("MyObject", "MyServer");
MyObject obj = (MyObject)Activator.GetObject(t, uri);

But I get this exception: > Cannot create channel sink to connect to URL 'partition:{41e90f3e-56c1-4633-81c3-6e8bac8bdd70}/new:MyObject'. An appropriate channel has probably not been registered.

Does anybody know how such an activation can be accomplished?

C# Solutions


Solution 1 - C#

  1. Make sure your Com is public and visible. To do this, add these tags to your Com class:

    [ClassInterface(ClassInterfaceType.AutoDual)]
    [Guid("41E90F3E-56C1-4633-81C3-6E8BAC8BDD70")]
    [ProgId("..........")]
    [ComVisible(true)] 
    public class MyCom
    {
    
  2. Make sure your COM has been registered. You can do this using the command line:

    C:\WINDOWS\Microsoft.Net\Framework\v4.0.30319\regasm "C:\.......\xxx.dll"
    

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKhaled SalehView Question on Stackoverflow
Solution 1 - C#mtz1406View Answer on Stackoverflow