There was an error in this gadget

Monday, June 11, 2012

WCF Client Sends Mesasge size 65536 Error


Is the error occuring when the client sends a message to the server? 
If so, check to make sure that in your server's config file the endpoint is referencing the binding you created:
<endpoint address="" binding="wsHttpBinding" 
 bindingConfiguration="NewBinding0" contract="IDBSyncContract" />
If you don't reference the binding you created named "NewBinding0" via the endpoint element's bindingConfiguration attribute, WCF will use the default values for WsHttpBinding - which in the case of MaxReceivedMessageSize is 65536.
UPDATE
Setting the MaxReceivedMessageSize value on the server side config is exactly the same as it is on the client config. Simply set the maxReceivedMessageSize attribute on the binding element:
<wsHttpBinding>
  <binding name="NewBinding0" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00" maxReceivedMessageSize="20000000"> 
    <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    <reliableSession enabled="true" /> 
    <security mode="None">
      <transport clientCredentialType="None" /> 
      <message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="false" /> 
    </security>
  </binding>
</wsHttpBinding>

No comments:

Post a Comment