我在COM+服务器应用程序中安装了一个服务组件。我想从远程客户端创建一个实例。客户端需要能够动态地指定服务器机器的名称。我该怎么做呢?
我尝试使用Activator:
(XSLTransComponent.XSLTransformer)Activator.GetObject(
typeof(XSLTransComponent.XSLTransformer),
serverName
);但我得到的是:
服务器:无法创建信道接收器以连接到URL‘System.Runtime.Remoting.RemotingException’。可能尚未注册适当的通道。at System.Runtime.Remoting.RemotingServices.Unmarshal(Type classToProxy,字符串url,对象数据)
我需要注册一个频道吗?如果是这样的话,是怎么做的?
另一个想法是使用Marshall.BindToMoniker,但是如何为服务器x上的COM+上托管的远程对象指定名字对象呢?
发布于 2009-01-27 20:57:51
尤里卡!这是可行的:
string serverName = serverTextBox.Text;
Type remote = Type.GetTypeFromProgID("XSLTransComponent.XSLTransformer", serverName);
return (XSLTransComponent.XSLTransformer)Activator.CreateInstance(remote);感谢this question
https://stackoverflow.com/questions/485000
复制相似问题