title: The max message size quota for incoming messages (65536) ....To increase the quota, use the MaxReceivedMessageSize property
body: <p>I got this crazy problem I'm trying to deal with. I know that when we're getting huge amount of data we must increase the quota on client .config file, but what am I supposed to do if my client is sending huge data "to" the WCF server? </p>
  
  <p>It works perfectly normal when I'm sending small sized input parameter. Unfortunately, it breaks down when the input grows bigger. </p>
  
  <p>Debugger it says: </p>
  
  <blockquote>
    <p>Bad Request, 400;</p>
  </blockquote>
  
  <p>on trace file it is:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>Is there some way to increase this quota of incomming data on the server side? if so, how?</p>
  
  <p>Here's my sample config related parts:</p>
  
  <pre><code>&lt;bindings&gt;
    &lt;basicHttpBinding&gt;
      &lt;binding name="MyBasicHttpBinding"
          closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00"
          sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false"
          hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647"
          maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true"&gt;
        &lt;readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"  /&gt;
        &lt;security mode="None"&gt;
          &lt;transport clientCredentialType="None" proxyCredentialType="None"
              realm="" /&gt;
          &lt;message clientCredentialType="UserName" algorithmSuite="Default" /&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
  
    &lt;/basicHttpBinding&gt;
  &lt;/bindings&gt;
  
   &lt;services&gt;
    &lt;service name="MyWcfService"&gt;
      &lt;endpoint address="http://myservice..."
        binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBinding"
        name="MyBasicHttpBinding" contract="IMyContract" /&gt;
    &lt;/service&gt;
  &lt;/services&gt; 
  </code></pre>
  
  <p>and here's my client-side code (I create it dynamically):</p>
  
  <pre><code>        var binding = new BasicHttpBinding();
          binding.MaxBufferPoolSize = 2147483647;
          binding.MaxBufferSize = 2147483647;
          binding.MaxReceivedMessageSize = 2147483647;
          binding.ReaderQuotas.MaxStringContentLength = 2147483647;
          binding.ReaderQuotas.MaxArrayLength = 2147483647;
          binding.ReaderQuotas.MaxDepth = 2147483647;
          binding.ReaderQuotas.MaxBytesPerRead = 2147483647;
  
  
          var address = new EndpointAddress("http://mylocalservice.."); 
  
          ChannelFactory&lt;IMyContract&gt; factory = new ChannelFactory&lt;IMyContract&gt;(binding, address);
  
          foreach (OperationDescription op in factory.Endpoint.Contract.Operations)
          {
              DataContractSerializerOperationBehavior dataContractBehavior =
                          op.Behaviors.Find&lt;DataContractSerializerOperationBehavior&gt;()
                          as DataContractSerializerOperationBehavior;
              if (dataContractBehavior != null)
              {
                  dataContractBehavior.MaxItemsInObjectGraph = 2147483646;
              }
          }
          public IMyContract MyClientObject = factory.CreateChannel();
  </code></pre>