Kinexus
Kinexus

Reputation: 12904

Error with WCF configuration for MaxReceivedMessageSize

I am getting the following error when calling my service;

The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

The configuration of the service is;

   <bindings>
      <basicHttpBinding>
        <binding name="basic" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" >
          <readerQuotas maxDepth="32" maxStringContentLength="67108864" maxArrayLength="10240000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="Company.Product.Service.FileManager.IFileManager">
        <endpoint binding="basicHttpBinding" bindingConfiguration="basic" name="FileManager" bindingNamespace="Company.Product.FileManager.FileManagerService" contract="Company.Product.Service.FileManager.IFileManager" />
        <host>
          <baseAddresses>
            <add baseAddress="http://filemanager.dev.v7.services.Company.net" />
          </baseAddresses>
        </host>
      </service>
    </services>

As you can see, I have adjusted the settings accordingly, so not sure why I am still getting this error.

Client Configuration;

 <bindings>
      <basicHttpBinding>
        <binding name="basic" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="67108864" maxArrayLength="10240000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>

      <endpoint address="http://filemanager.dev.v7.services.Company.net/service.svc" binding="basicHttpBinding" bindingConfiguration="basic" contract="Company.Product.Service.FileManager.IFileManager" name="FileManager"/>
    </client>

Update

Changing the service configuration to this (removed the binding name) and this now works, but why would it not work with a named configuration;

<bindings>
      <basicHttpBinding>
        <binding name="" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" >
          <readerQuotas maxDepth="32" maxStringContentLength="67108864" maxArrayLength="10240000" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding>
    </bindings>

Upvotes: 0

Views: 266

Answers (1)

flayn
flayn

Reputation: 5322

You have to change the app.config of your client as well.

Edit:

If you leave the name attribute empty it will be applied to every binding of the type that is not named. If you have a named binding in the config it will only be picked up if it is explicitly referenced by that name.

Upvotes: 1

Related Questions