Monday, July 28, 2014

WCF – The maximum string content length quota (8192) has been exceeded while reading XML data

The DataContractSerializer in WCF serializes objects to XML Streams. There is a size (length) limitation on these streams. They are restricted by default to 8k (8192 bytes).While this helps in avoiding Denial of Service (Dos) attacks, it is an inconvenience for several service operations that DO return LARGER than 8k size objects. The result set from a single query returned by a WCF service could constitute one such large object. When this happens, the WCF run-time throws an exception:The maximum string content length quota (8192) has been exceeded...