.net COM+ 返回 IDataReader 的对象

发布于 2024-07-06 16:24:30 字数 462 浏览 6 评论 0原文

我创建了一个派生自 ServicedComponent 的 .net 类,并将其注册到 COM+。 该组件实现的接口有一个返回 IDataReader 的方法。 当我从客户端应用程序调用服务组件时,一切正常,我可以调用返回 IDataReader 的方法,没有问题,但一旦我调用对象上的方法,我就会得到异常: “System.Runtime.Remoting.RemotingException:此远程代理没有通道接收器,这意味着服务器没有正在侦听的注册服务器通道,或者此应用程序没有合适的客户端通道与服务器通信。”

我对我的代码进行了相当多的修改,并意识到如果我创建自己的可序列化的 IDataReader 实现(具有可序列化属性),它就会起作用。 如果实现派生自 MarshalByRefObject,则会失败。

那么,是否可以通过 COM+ ServicedComponents 的引用返回标准 .net 对象,如果可以,我需要做什么才能实现它?

I've created a .net class derived from ServicedComponent and registered it with COM+. The interface that this component implements has a method that returns an IDataReader. When I call the serviced component from my client application everything works I can call the method that returns the IDataReader no problem but as soon as I call a method on the object I get the exception:
"System.Runtime.Remoting.RemotingException : This remoting proxy has no channel sink which means either the server has no registered server channels that are listening, or this application has no suitable client channel to talk to the server."

I hacked my code a fair bit and realized that it would work if I created my own implementation of IDataReader that was serializable (has the Serializable attribute). If the implementation derives from MarshalByRefObject it fails.

So, is it possible to return standard .net objects by reference from COM+ ServicedComponents and if so what do I need to do to achieve it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

少女情怀诗 2024-07-13 16:24:30

当 COM+ 客户端和 COM+ 组件都受到管理时,CLR 会尝试变得“智能”并尝试切换到使用 .Net 远程处理作为通信通道。

要使此方案发挥作用,您可以为实现 IDataReader 的对象注册一个远程处理通道。

不幸的是,我无法访问几年前执行此操作的代码,因此我无法发布示例。 :-(

When your COM+ client and COM+ component are both managed, the CLR tries to be "smart" and attempts to switch to using .Net remoting as a communication channel.

To make this scenario work, you can register a remoting channel for your object that implements IDataReader.

Unofrtunately, I have no access to the code where I did this couple of years ago, so I can't post a sample. :-(

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文