views:

2068

answers:

0

Hello,

I'm about to port an application to silverlight. Until now my client application talked to the server using netTcpBinding. However Silverlight doesn't support that, and I found out that they recommend to use a custom binding instead.

I'd like to know wether I need to configure the binding in a special way regarding security. My distributed application works well when the client and the server are running in the same machine but not when running in different ones. In this case I get the following error:

The message with action 'http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions betwwen sender and receiver) or a binding/security mismatch between the sender and the revceiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

I have already checked the contract and the binding (the problem arises when switching to custom binding while it works ok with netTcpBinding). The port is enabled at the firewall too. Based on the error message I think WCF may be asuming some security defaults which doesn't match in the client and the server.

The server config file is as follows:

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="MetaEnabledBehavior" name="MyService">
        <host>
          <baseAddresses>
            <add baseAddress="http://MyIP:Port#/MyService"/&gt;
          </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>

And the client configuration is like this:


<?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>

related questions