title: WCF readerQuotas settings - drawbacks?
body: <p>If a WCF service returns a byte array in its response message, there's a chance the data will exceed the default length of 16384 bytes. When this happens, the exception will be something like</p>
  
  <blockquote>
    <p>The maximum array length quota (16384)
    has been exceeded while reading XML
    data. This quota may be increased by
    changing the MaxArrayLength property
    on the XmlDictionaryReaderQuotas
    object used when creating the XML
    reader.</p>
  </blockquote>
  
  <p>All the advice I've seen on the web is just to increase the settings in the <code>&lt;readerQuotas&gt;</code> element to their maximum, so something like</p>
  
  <pre><code>&lt;readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                maxArrayLength="2147483647" maxBytesPerRead="2147483647"
                maxNameTableCharCount="2147483647" /&gt;
  </code></pre>
  
  <p>on the server, and similar on the client.</p>
  
  <p>I would like to know of any drawbacks with this approach, particularly if the size of the byte array may only occassionally get very large. Do the settings above just make WCF declare a huge array for each request? Do you have to limit the maximum size of the data returned, or can you just specify a reasonably-sized buffer and get WCF to keep going until all the data is read?</p>
  
  <p>Thanks!</p>