2

アプリケーションを Silverlight に移植しようとしています。これまで、クライアント アプリケーションは netTcpBinding を使用してサーバーと通信していました。ただし、Silverlight はそれをサポートしていないため、代わりにカスタム バインディングを使用することを推奨していることがわかりました。

セキュリティに関して特別な方法でバインディングを構成する必要があるかどうかを知りたいです。私の分散アプリケーションは、クライアントとサーバーが同じマシンで実行されている場合はうまく機能しますが、別のマシンで実行されている場合は機能しません。この場合、次のエラーが表示されます。

アクション ' http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence ' を持つメッセージは、EndpointDispatcher での ContractFilter の不一致により、受信側で処理できません。これは、コントラクトの不一致 (送信者と受信者の間のアクションの不一致) または送信者と受信者の間のバインディング/セキュリティの不一致が原因である可能性があります。送信者と受信者が同じコントラクトと同じバインド (メッセージ、トランスポート、なしなどのセキュリティ要件を含む) を持っていることを確認します。

私はすでにコントラクトとバインディングを確認しました (netTcpBinding では正常に動作しているが、カスタム バインディングに切り替えると問題が発生します)。ポートはファイアウォールでも有効になっています。エラー メッセージに基づいて、WCF は、クライアントとサーバーで一致しないいくつかのセキュリティの既定値を想定している可能性があると思います。

サーバー構成ファイルは次のとおりです。

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="MetaEnabledBehavior" name="MyService">
        <host>
          <baseAddresses>
            <add baseAddress="http://MyIP:Port#/MyService"/>
          </baseAddresses>
        </host>

        <endpoint address="custom"
                  binding="customBinding"
                  contract="MyService"
                  bindingConfiguration="binaryHttpBinding"                   
                  />
      </service>
    </services>
    <bindings>

      <customBinding>
        <binding name="binaryHttpBinding">
          <binaryMessageEncoding />          
          <reliableSession ordered="true" inactivityTimeout="01:00:00"/>
          <httpTransport />
        </binding>
      </customBinding>

    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MetaEnabledBehavior">
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <startup>
    <supportedRuntime version="v2.0.50727"/>
  </startup>
</configuration>

クライアント構成は次のようになります。


<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
    <bindings>

      <customBinding>
        <binding name="default_binding">

          <reliableSession ordered ="true" inactivityTimeout="01:00:00"/>
          <binaryMessageEncoding maxReadPoolSize="64" 
                                 maxWritePoolSize="16"
                                 maxSessionSize="2048">
            <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />          

          </binaryMessageEncoding>
          <httpTransport manualAddressing="false" maxBufferPoolSize="524288"
              maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
              bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
              keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
              realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
              useDefaultWebProxy="true" />
        </binding>
      </customBinding>

    </bindings>
    <client>

      <endpoint address="http://MyIP:Port#/MyService/custom"
                binding ="customBinding"
                contract="MyService"
                bindingConfiguration = "default_binding"
                name="default_binding" />

    </client>
  </system.serviceModel>
</configuration>
4

0 に答える 0