0

Silverlight 4 クライアント用にプログラムで NetTcpBinding を構成したいと考えています。(NetTcpBinding がサポートされるようになりました)

Windows フォーム クライアントでこれを行うために使用するコードを次に示します。

  EndpointAddress endpointAddress = new EndpointAddress(uri);
  NetTcpBinding netTcpBinding = new NetTcpBinding();
  MyServiceClient agentClient = new MyServiceClient(new InstanceContext(this), netTcpBinding, endpointAddress);

Silverlight の場合、System.ServiceModel.Extensions と System.ServiceModel.NetTcp への参照を追加しましたが、これだけでは不十分です。NetTcpBinding クラスが見つかりません。

存在する場合、このクラスはどこにありますか? 同等の構文は存在しますか? 構成ファイルが使用されている場合、silverlight 4 ランタイムは何らかの方法でこれを行っている必要があります。

4

1 に答える 1

3

NetTcpBinding の代わりにカスタム バインディングを使用できます。以下のコードは機能していますが、これが推奨されるパターンかどうかはわかりません。

  BinaryMessageEncodingBindingElement messageEncoding = new BinaryMessageEncodingBindingElement();
  TcpTransportBindingElement tcpTransport = new TcpTransportBindingElement();
  CustomBinding binding = new CustomBinding(messageEncoding, tcpTransport);
于 2010-05-28T09:11:42.463 に答える