WCF CustomPeerResolverService 在没有 LAN 连接的情况下无法工作
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用环回适配器,它用于测试在没有网络时假设有网络的事物。
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