COM+ object activation in a different partition
Asked Answered
S

1

51

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?

Selfrighteous answered 18/1, 2012 at 20:21 Comment(6)
Are you trying to activating a native (in the sense not .NET) COM+ component or we're talking of a ServicedComponent (written for CLR even if published using COM+ infrastructure)?Wheresoever
Until you give this detail. You can refer to this other question: #12638378 and also to Marshal.BindToMoniker MSDN doc (msdn.microsoft.com/en-us/library/…).Wheresoever
Just to be sure. You can try to run your code with higher privileges (as Administrator), if it works maybe that you're running with too lower privileges.Wheresoever
did you grant enough rights for the COM+ app in Component Services?Terret
Have you tried to create an instance of the object? #485500Clothesline
Sorry guys to not be responsive with your suggestions since I went towards a totally different approach. The idea behind the need of many different COM+ partitions was to enable multiple server configurations like: database, security and so the client decides what configuration profile he needs by selecting the proper server, the solution I took was sending the configurations profile identity across the communication channel from the client to server with each call silently, the server intercept it and take the right route.Selfrighteous
W
1
  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"
    
Welbie answered 19/2, 2013 at 13:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.