チャットアプリの利用可能なMicrosoftの例を使用して、ピアツーピアWCFを使用するようにVB.Net3.5アプリを変換しました。サンプルのapp.configファイルをコピーし(アプリの名前を変更)、適切な参照を追加したことを確認しました。すべてのチュートリアルに従い、アプリコードに適切なタグと構造を追加しました。すべてがエラーなしで実行されますが、クライアントは自分自身からのみメッセージを受け取り、他のクライアントからはメッセージを受け取りません。サンプルチャットアプリケーションは、複数のクライアントで問題なく実行されます。私が見つけた唯一の違いは、サンプルのサーバーがフレームワーク2.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>
よろしくお願いします。