Yuropoor
Yuropoor

Reputation: 353

How to set MessageVersion in binding in app.config?

I have a binding in my app.config file like so:

 <bindings>    
  <basicHttpBinding>        
    <binding name="WebapiBindingWithCred" maxReceivedMessageSize="2147483647" messageEncoding="Text">
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
        maxArrayLength="16348" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="TransportWithMessageCredential">
        <message clientCredentialType="UserName"/>          
      </security>        
    </binding>   
  </basicHttpBinding>
</bindings>

When I use it, I get `Unrecognized message version' error as a response. I've read I should set my MessageVersion to Soap11, but I can't find the tag to do so anywhere. How can I do it?

Upvotes: 0

Views: 1366

Answers (1)

Baldrick
Baldrick

Reputation: 11840

You need the following tag in your binding:

<textMessageEncoding messageVersion="Soap11" />

However, you need to use a custom binding though, rather than the basicHttpBinding:

 <customBinding>  
    <binding name="HttpBinding" >  
        <textMessageEncoding   
            messageVersion="Soap11"/>  
        <httpTransport />  
    </binding>  
 </customBinding> 

Upvotes: 1

Related Questions