1

私はCSLA.NETを使用しています。これは、wsHttpBinding で非常にうまく機能します。今、私は自分のWindowsサービスを持っており、このWindowsサービスをCSLAサーバーとして使用し、nettcpbindingを使用して解決策を探しています。誰かが先に進むためのヒントを教えてもらえますか? おそらく、誰かが私がそれを行う方法のサンプルを持っています。

ありがとうございました!

よろしく、 トーマス

4

1 に答える 1

1

基本的に、2つのことを行う必要があります。

  • サーバー側の構成を変更して、netTcpBindingを含むエンドポイントを含めます(これは、既存のwsHttpBindingエンドポイントに追加できます-問題ありません)

  • netTcpBindingをクライアントの構成ファイルにも追加し、接続時にそのエンドポイントを選択します

サーバー側の構成には次のようなものが必要です。

<services> 
   <service name="YourService">
      <endpoint name="something"
                address=""
                binding="wsHttpBinding"
                contract="IYourService" />
   </service>
</services>

netTcpBindingのエンドポイントを追加するだけです。

<services> 
   <service name="YourService">
      <endpoint name="something"
                address=""
                binding="wsHttpBinding"
                contract="IYourService" />
      <endpoint name="something"
                address="net.tcp://YourServer:7171/YourService"
                binding="netTcpBinding"
                contract="IYourService" />
   </service>
</services>

ここで、IISでホストしている場合、いくつかの問題が発生する可能性があります。IIS7(Win2008またはWin2008R2サーバー)を構成する必要があり、IIS6では、IIS6でnetTcpサービスをホストできません:-(

クライアント側でも同じです-netTcpの2番目のエンドポイントを追加します。

<client>
    <endpoint name="something"
              address="http://YourServer/SomeVirtDir/YourServiceFile.svc"
              binding="wsHttpBinding"
              contract="IYourService" />
    <endpoint name="netTcpEndpoint"
              address="net.tcp://YourServer:7171/YourService"
              binding="netTcpBinding"
              contract="IYourService" />
</client>

コードでエンドポイントを作成するときは、名前付きエンドポイントを使用します。

YourServiceClient client = new YourServiceClient("netTcpEndpoint");

それがすべてであるはずです(CSLAが私が知らない何か余分なものを必要としない限り....私は「プレーンバニラ」WCFを知っています)

于 2010-04-16T18:40:22.547 に答える