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?

w5m
  • 2,259
  • 3
  • 29
  • 42
Khaled Saleh
  • 513
  • 3
  • 7
  • 1
    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)? – gsscoder Jan 09 '13 at 12:02
  • Until you give this detail. You can refer to this other question: http://stackoverflow.com/questions/12637878/how-can-i-instantiate-a-com-class-interface-generically and also to Marshal.BindToMoniker MSDN doc (http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.bindtomoniker.aspx). – gsscoder Jan 09 '13 at 12:09
  • 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. – gsscoder Jan 20 '13 at 10:41
  • did you grant enough rights for the COM+ app in Component Services? – Adi Feb 02 '13 at 19:43
  • Have you tried to create an instance of the object? http://stackoverflow.com/questions/485000/calling-a-remote-com-servicedcomponent-from-a-c-sharp-client – HaniGamal Feb 18 '13 at 02:31
  • 1
    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. – Khaled Saleh Jul 22 '13 at 20:55

1 Answers1

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"
    
demongolem
  • 8,796
  • 36
  • 82
  • 101
mtz1406
  • 51
  • 1
  • 9