我转换了一个VB 3.5应用程序,使用聊天应用程序的可用微软示例来使用点对点.Net。我确保我复制了示例的app.config文件(修改了我的应用程序的名称),添加了适当的引用。我遵循了所有的教程,并在我的应用程序代码中添加了适当的标签和结构。一切运行都没有任何错误,但是客户端只从自己而不是从其他客户端获得消息。示例聊天应用程序在多个客户端上运行得很好。我能找到的唯一区别是,示例中的服务器针对的是Framework2.0,但我认为这是错误的,它至少在3.0中构建了它,否则System.ServiceModel引用将会崩溃。样本在幕后是否需要注册,或者样本是一个特殊的项目类型?我很困惑。我的下一步是将我的所有类和逻辑从我的应用程序复制到示例应用程序,但这可能需要大量的工作。
这是我的客户端App.config:
<client><endpoint name="thldmEndPoint"
address="net.p2p://thldmMesh/thldmServer"
binding="netPeerTcpBinding"
bindingConfiguration="PeerTcpConfig"
contract="THLDM_Client.IGameService"></endpoint></client>
<bindings><netPeerTcpBinding>
<binding name="PeerTcpConfig" port="0">
<security mode="None"></security>
<resolver mode="Custom">
<custom address="net.tcp://localhost/thldmServer" binding="netTcpBinding"
bindingConfiguration="TcpConfig"></custom>
</resolver>
</binding></netPeerTcpBinding>
<netTcpBinding>
<binding name="TcpConfig">
<security mode="None"></security>
</binding>
</netTcpBinding>
</bindings>这是我的服务器App.config:
<services>
<service name="System.ServiceModel.PeerResolvers.CustomPeerResolverService">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost/thldmServer"/>
</baseAddresses>
</host>
<endpoint address="net.tcp://localhost/thldmServer"
binding="netTcpBinding"
bindingConfiguration="TcpConfig"
contract="System.ServiceModel.PeerResolvers.IPeerResolverContract">
</endpoint>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="TcpConfig">
<security mode="None"></security>
</binding>
</netTcpBinding>
</bindings>提前谢谢你。
发布于 2010-05-02 01:05:18
我想我已经找到答案了。我有一个不冒泡的异常(由于单向操作契约),它将关闭该实例。一旦它停止工作,就不会再有消息了。如果MS至少将这些异常放到输出堆栈中,那就太好了。现在,我优雅地处理了错误,消息将发送到所有客户端。需要注意的一点是,如果您使用的是单向合约,则不能以任何方式将异常冒泡到客户端。我想我理解了,因为如果4个同级都有异常,你会得到哪个异常(全部4个?)因此,我猜在消息广播的对等网络中,您无法获得任何类型的回复是有意义的。
https://stackoverflow.com/questions/2750478
复制相似问题