为什么来自服务器的 .NET 远程事件无法到达不同计算机上的客户端

发布于 2024-07-27 02:48:21 字数 278 浏览 9 评论 0原文

就我而言,当数据准备好时,服务器将通知客户端获取他的数据。 该通知是通过客户端必须订阅的事件来实现的。

当在同一台计算机上进行测试时,客户端会毫无问题地收到通知。 但是,当客户端移动到另一台计算机时,它无法再收到通知。

我检查了网络连接和远程服务的可用性,发现客户端可以访问服务器端编组的远程对象,事件订阅正常,没有任何异常。

但令我困惑的是,实际上服务器的事件== null,意味着客户端的方法从未在这里注册。

有谁知道原因吗? 谢谢 BR

In my case, the server will notify the client to fetch his data when the data is ready. This notification is implemented via an event which the client has to subscribe.

When tested in the same computer, the client get notified without any problems. However, when client is moved to the other computer, it cannot get the notifications any more.

I checked the network connection and the availability of remoting service, and found the client can access the remoting object marshalled on the server end, event subscription was fine without any exceptions.

But what confused me is that actually the server's event == null, means client's method never registered here.

Does anybody know the cause?
Thanks
BR

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

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

发布评论

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

评论(3

酒儿 2024-08-03 02:48:21

注册到服务器事件的每个客户端对象都应该是 MarshalByRefObject 并且它的程序集应该由服务器引用。 因此,如果您想在远程处理中使用事件,则需要事件包装器。

也许,本文可能对您有所帮助。

http://aviadezra.blogspot.com/2008/ 06/code-snippets-remoting-client-server_19.html

Each client object that register to server event should be MarshalByRefObject and its assembly should be referenced by the server. So you need wrappers around events if you want to use them in remoting

Perhaps, this article may help you.

http://aviadezra.blogspot.com/2008/06/code-snippets-remoting-client-server_19.html

晚风撩人 2024-08-03 02:48:21

首先,我会查看客户端和服务器上的事件日志,看看是否存在与此相关的错误。

其次,远程客户端和本地客户端的用户身份是否相同? 使用同一域帐户的同一登录用户?

防火墙设置怎么样? 您确定允许远程处理吗?

最后,只是为了确保:您是否知道 Remoting 现在已被弃用,取而代之的是 WCF?

First of all, I'd look in the event logs on both the client and the server to see if there are errors related to this.

Second, is it the same user identity with the remote client and with the local client? Same logged in user with the same domain account?

What about firewall setup? Are you sure that Remoting is allowed in?

Finally, just to make sure: are you aware that Remoting is now deprecated in favor of WCF?

像你 2024-08-03 02:48:21

如果远程调用是双向的,则端口需要在两个方向上都可打开,这意味着您的服务器需要能够在客户端上打开端口。 您将有两个打开的套接字,双向通信。

If remoting calls are going both directions, ports need to be openable in both directions meaning your server needs to be capable of opening a port on your clients. You'll have two sockets open, bi direction communication.

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