在不同分区中激活COM +对象 [英] COM+ object activation in a different partition

查看:87
本文介绍了在不同分区中激活COM +对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个COM +域分区,然后将其映射到Windows 2008服务器计算机,并将COM +应用程序导入其中.

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

我尝试使用以下C#代码从服务器上的该特定分区远程激活对象:

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:

无法创建频道接收器以连接到URL分区:{41e90f3e-56c1-4633-81c3-6e8bac8bdd70}/new:MyObject".适当的频道可能尚未注册.

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?

推荐答案

  1. 确保您的Com是公开的并且可见.为此,请添加这些 您的Com类的标签:

  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
{

  • 确保已注册您的COM.您可以使用命令行执行此操作:

  • 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"
    

  • 这篇关于在不同分区中激活COM +对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆