1
votes

I have a WCF service in which I'm trying to pull out a certain XML file, and send this file to the client, but I keep getting this error:

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.

I have changed the maxReceivedMessageSize in my app.config.

App.config

Endpoint configuration

<services>
  <service name="MobileReportService.Service" behaviorConfiguration="ServiceBehavior">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8733/Design_Time_Addresses/MobileReportService/Service/" />
      </baseAddresses>
    </host>
    <endpoint name="ServiceEndpoint"
            binding="basicHttpBinding"
            contract="MobileReportService.IService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

Binding configuration

<bindings>
  <basicHttpBinding>
    <binding maxBufferPoolSize="5242880" maxBufferSize="5242880"
      maxReceivedMessageSize="5242880" />
  </basicHttpBinding>
</bindings>

I don't quite understand why the maxReceivedMessageSize can't be read?

Edit

I'm testing the service through the popup that appears whenever I run the service, by pressing "Invoke"

enter image description here

1

1 Answers

3
votes

You need to remove the binding name. There is no need to define a binding name unless you are defining more than one basicHttpBinding configuration. If you remove the name the defined settings will apply to all endpoints using the binding type.

<bindings>
  <basicHttpBinding>
    <binding maxReceivedMessageSize="(big number)" />
  </basicHttpBinding>
</bindings>