DarthVader
DarthVader

Reputation: 55022

The maximum message size quota for incoming messages (65536) has been exceeded

I have the following configuration for a WCF service.

Even though I have increased the maxReceivedMessageSize , service still throws an 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.`" exception.

How can this be solved?

  <system.serviceModel>
    <services>
      <service name="MyService" behaviorConfiguration="MyServiceTypeBehaviors">
        <endpoint address="http://localhost:22230/MyService.svc"
              binding="basicHttpBinding"
              bindingConfiguration="MyServiceBinding"
              contract="IMyService" />

        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
      </service>
    </services>

    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceTypeBehaviors" >
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <basicHttpBinding>
        <binding name="MyServiceBinding"
               hostNameComparisonMode="StrongWildcard"
               receiveTimeout="00:10:00"
               sendTimeout="00:10:00"
               openTimeout="00:10:00"
               closeTimeout="00:10:00"
               maxReceivedMessageSize="6553600"
               maxBufferSize="6553600"
               maxBufferPoolSize="524288"
               transferMode="Buffered"
               messageEncoding="Text"
               textEncoding="utf-8"
               bypassProxyOnLocal="false"
               useDefaultWebProxy="true" >
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>
  </system.serviceModel

Upvotes: 9

Views: 35885

Answers (3)

Osama Ibrahim
Osama Ibrahim

Reputation: 1021

Be sure you copy the new App.config

Upvotes: 0

Jacob Tabak
Jacob Tabak

Reputation: 8084

You need to increase the max message size in your client config. The default is 65536, doubling it may be sufficient for your needs.

If you are configuring your endpoints programmatically, the following code snippet may help:

BasicHttpBinding binding = new BasicHttpBinding() { MaxReceivedMessageSize = 131072 };

Then, when instantiating your service client, pass in this binding object to the constructor. For example:

MyServiceClient client = new MyServiceClient(binding, "http://www.mysite.com/MyService/");

Upvotes: 4

Peter
Peter

Reputation: 27934

If this is the service config, you should look in your client config and match the maxReceivedMessageSize to the servers message size. The message is coming from your client.

Upvotes: 15

Related Questions