WCF CustomPeerResolverService 在没有 LAN 连接的情况下无法工作

发布于 2024-08-05 07:36:39 字数 555 浏览 3 评论 0原文

我正在使用 CustomPeerResolverService(在 Windows 服务中运行,并将其托管在 ServiceHost 中)与对等网络上的多个对等点。我的服务器地址是

net.tcp://127.0.0.1/Server

这个想法是,当没有网络连接时,服务器和对等点将在本地计算机上工作。

我扩展了 CustomPeerResolverService 类,这样我就可以看到发生了什么,当没有 LAN 连接时实际发生的情况是对等点调用 Resolve 方法,该方法询问“是否有其他对等点,我如何找到它们”,但他们从不调用 register 方法。

这意味着服务器总是说“不,没有其他对等点”,因为没有一个对等点实际注册了自己。

总体而言,这会导致对等点和解析服务之间建立连接,但不会在对等点之间产生任何连接。

当我打开 LAN 连接时,每个对等点都会调用注册方法,并且一切正常。

但我注意到一件事,当 LAN 启用时,每个对等点都有两个到 CustomPeerResolverService 的 TCP 连接,但在禁用 LAN 时只有一个。

有什么想法吗?

I am using a CustomPeerResolverService (running in a windows service which hosts it in a ServiceHost) with a number of peers on a peer to peer network. My server address is,

net.tcp://127.0.0.1/Server

The idea being that the server and peers would work on a local machine when there was no network connection.

I have extended the CustomPeerResolverService class so I could see what was going on, and what actually happens when there is no LAN connection is that the peers call the Resolve method, which is asking "Are there any other peers, and how can I find them", but they never call the register method.

This means that the server is always saying 'no there are no other peers' because none of the peers actually registered themselves.

Overall this results in connections between the peers and the resolution service, but never any connections between peers.

When I switch on my LAN connection the register method is called by each peer, and everything works properly.

I noticed something though, each peer had two TCP connections to the CustomPeerResolverService when the LAN was enabled, but only one when it was disabled.

Any ideas?

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

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

发布评论

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

评论(1

痴情换悲伤 2024-08-12 07:36:39

您可以使用环回适配器,它用于测试在没有网络时假设有网络的事物。

http://support.microsoft.com/kb/839013

You could use a loopback adapter, it is used for testing things that assume a network when there is no network.

http://support.microsoft.com/kb/839013

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