title: How to Increase the MaxArrayLength in a WCF web.config - for uploading large files
body: <p>I have dig all around the net for two days about it, and I can't make my asp.net web site to upload files bigger then 16Kb
  I'm using fileUploader,wcf, and I have service reference in the client.
  when I upload file in 30KB size it asked me to increase the MaxArrayLength.</p>
  
  <blockquote>
    <p>The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the
    2
     MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 205847.</p>
  </blockquote>
  
  <p>and it's just what I did, but it keeps complaining about this.</p>
  
  <p>if I upload file in 1MB size, I get error 400.</p>
  
  <blockquote>
    <p>The remote server returned an error: (400) Bad Request</p>
  </blockquote>
  
  <p>please help</p>
  
  <p>the client app.config:</p>
  
  <pre><code>&lt;bindings&gt;
    &lt;basicHttpBinding&gt; 
  
      &lt;binding name="streamingBinding"
                transferMode="Streamed"/&gt;
  
  
      &lt;binding name="BasicHttpBinding_IBLServer" 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="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
        &lt;security mode="TransportCredentialOnly"&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;client&gt;
  
    &lt;endpoint address="http://localhost:8888/BLService.svc" binding="basicHttpBinding"
      bindingConfiguration="BasicHttpBinding_IBLServer" contract="WSRef.IBLServer"
      name="BasicHttpBinding_IBLServer" /&gt;
  &lt;/client&gt;
  </code></pre>
  
  <p></p>
  
  <p>the WCF web.config:</p>
  
  <pre><code> &lt;system.serviceModel&gt;
  &lt;behaviors&gt;
    &lt;serviceBehaviors&gt;
      &lt;behavior&gt;
        &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt;
        &lt;serviceMetadata httpGetEnabled="true"/&gt;
        &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt;
      &lt;/behavior&gt;
      &lt;behavior name="BLServer.BackEndBehavior"&gt;
        &lt;serviceMetadata httpGetEnabled="true"/&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
        &lt;dataContractSerializer maxItemsInObjectGraph="2147483647" /&gt;
        &lt;serviceTimeouts transactionTimeout="05:05:00" /&gt;
        &lt;serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500"
         maxConcurrentInstances="2147483647" /&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt;
  
  
  &lt;bindings&gt;
    &lt;basicHttpBinding&gt;
      &lt;binding name="streamingBinding"
                transferMode="Streamed"/&gt;
  
      &lt;binding name="BasicHttpBinding_IBLServer"
         maxBufferPoolSize="2147483647" maxBufferSize="2147483647" 
               maxReceivedMessageSize="2147483647"&gt;
        &lt;security mode="TransportCredentialOnly"&gt;
          &lt;transport clientCredentialType="Windows" /&gt;
        &lt;/security&gt;
            &lt;readerQuotas
                maxDepth="64"
              maxStringContentLength="2147483647"
               maxArrayLength="2147483647"
               maxBytesPerRead="4096"
               maxNameTableCharCount="16384"/&gt;
      &lt;/binding&gt;
  
    &lt;/basicHttpBinding&gt;
  &lt;/bindings&gt;
  
  &lt;services&gt;
    &lt;service behaviorConfiguration="BLServer.BackEndBehavior" name="WSRef.BackEnd"&gt;
         &lt;endpoint address="" binding="basicHttpBinding" 
                bindingConfiguration="BasicHttpBinding_IBLServer"
                contract="WSRef.IBLServer" /&gt;
  
    &lt;/service&gt;
  
  
    &lt;service name="StreamingService.Upload"&gt;
      &lt;endpoint address=""
                binding="basicHttpBinding"
                bindingConfiguration="streamingBinding"
                contract="StreamingService.IUpload"/&gt;
    &lt;/service&gt;
  &lt;/services&gt;
  </code></pre>
  
  <p></p>
  
  <p>files &lt;16 KB are uploaded successfully.</p>
  
  <p>can you please find out what I did wrong?</p>