title: maxReceivedMessageSize not fixing 413: Request Entity Too Large
body: <p>My call to my WCF web service is failing with <code>System.Net.WebException: The request failed with HTTP status 413: Request Entity Too Large.</code></p>
  
  <p>Checking Fiddler, I see that I'm sending:</p>
  
  <blockquote>
    <p>Content-Length: 149839</p>
  </blockquote>
  
  <p>Which is over 65KB.</p>
  
  <p>Enabling WCF tracing on the server, I see:</p>
  
  <blockquote>
    <p>System.ServiceModel.ProtocolException: 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>Adding this property doesn't solve the issue.</p>
  
  <p>I've tried with just that property, and (later) with various others that posts have suggested. Here's what I have currently <strong>(on the server)</strong>:</p>
  
  <pre><code>&lt;basicHttpBinding&gt;
  
    &lt;binding name="PricerServiceSoap"
      closeTimeout="00:10:00" openTimeout="00:10:00"
      receiveTimeout="00:10:00" sendTimeout="00:10:00"
      maxBufferSize="2147483647"    
      maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"&gt;
  
      &lt;readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647"
        maxNameTableCharCount="2147483647" /&gt;
    &lt;/binding&gt;
  
  &lt;/basicHttpBinding&gt;
  </code></pre>
  
  <p>My sole endpoint (under <code>&lt;client&gt;</code>) is:</p>
  
  <pre><code>&lt;endpoint address="/NetPricingService/Service.asmx"
    binding="basicHttpBinding" bindingConfiguration="PricerServiceSoap"
    contract="Pricing.PricerService.PricerServiceSoap"
    name="PricerServiceSoap" /&gt;
  </code></pre>
  
  <p>I've also added:</p>
  
  <pre><code>&lt;dataContractSerializer maxItemsInObjectGraph="2147483647"/&gt;
  </code></pre>
  
  <p>under <code>&lt;behavior&gt;</code>.</p>
  
  <p>I've even run (for IIS 7):</p>
  
  <pre><code>%windir%\system32\inetsrv\appcmd set config "WebServicesDev/PricingService"
  -section:requestFiltering -requestLimits.maxAllowedContentLength:104857600
  -commitpath:apphost
  </code></pre>
  
  <p>Nothing makes any difference.</p>
  
  <p><strong>One catch is that this is a WCF service meant to replace an older ASMX service. The service skeleton was generated with svcutil from existing WSDL. I can't change the client configurations</strong> (and the clients are in multiple languages). My test client project imported the service with Add Web Reference (under <code>Add Service Reference / Advanced</code>), so I have no WCF configuration. However, the test client works if I point it at the older ASMX service.</p>
  
  <p>How can I fix or diagnose this?</p>
  
  <p><strong>Additional info</strong></p>
  
  <p>If I use the Microsoft Service Configuration Editor to generate the config (setting maxReceivedMessageSize and maxBufferSize), it works. The problem is that the endpoint is then specified under <code>&lt;service&gt;</code>, and it won't let me specify the /NetPricingService/Service.asmx relative address. If I edit the bindings in the svcutil-generated config (where the endpoint is under <code>&lt;client&gt;</code>), it doesn't work with large requests.</p>