Navin Choubey
Navin Choubey

Reputation: 11

The client and service bindings may be mismatched

I consume WCF from my silverlight application. It started giving the following error since I made a change in binding configuration.

Error:

Content Type application/soap+xml; charset=utf-8 was sent to a service expecting application/soap+msbin1. The client and service bindings may be mismatched.

Configuration at Web.config of WCF Server:

  <customBinding>
    <binding name="WCFSilverlightService">
      <security authenticationMode="IssuedTokenOverTransport" requireDerivedKeys="false" includeTimestamp="true">
        <issuedTokenParameters keyType="BearerKey" tokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1"/>
        <secureConversationBootstrap/>
      </security>
      <!-- Error started coming when I added the below binaryMessageEncoding section -->
      <binaryMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647" maxSessionSize="2147483647">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
      </binaryMessageEncoding>
      <httpsTransport maxBufferPoolSize="2147483647"
        maxReceivedMessageSize="2147483647"
        maxBufferSize="2147483647"/>
    </binding>
  </customBinding>

Configuration in Silverlight ClientConfig File:

      <customBinding>
    <binding name="BearerTokensOverTransport" sendTimeout="00:05:00" receiveTimeout="00:10:00">
      <!-- Error started coming when I added the below binaryMessageEncoding section -->
      <binaryMessageEncoding maxReadPoolSize="2147483647" maxWritePoolSize="2147483647" maxSessionSize="2147483647">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
      </binaryMessageEncoding>
      <httpsTransport maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
    </binding>
  </customBinding>

Upvotes: 1

Views: 3442

Answers (1)

Dave
Dave

Reputation: 5029

This just happened to me, and the issue was that I did not have the correct namespace in the services element inside web.config.

http://msdn.microsoft.com/en-us/library/ms733932.aspx

For instance, the name attribute should have "a fully qualified name which consists of the namespace, a period, and then the type name. For example "MyNameSpace.myServiceType"."

I made sure namespaces were correct everywhere in web.config.

Upvotes: 1

Related Questions