Question

I have read on msdn that the attribute maxStringContentLength of the readerQuotas for a WCF client means:

A positive integer that specifies the maximum characters allowed in XML element content. The default is 8192.

I am probably a bit thick here, but what exactly are they refering to when saying XML element content? Is that the content in one XML element? And would it include any nested child elements? Or is that the limit of each element only without nested elements?

E.g. in the following structure:

<a>
 <b>baap</b>
 <c>beep</c>
</a>

Would tag a cause an overflow of the maxStringContentLength if baap and beep together were over the limit? Or would only b or c cause one if their respective contents were over the limit? Or am I totally missing something?

Thanks all!

Was it helpful?

Solution

From the MSDN:

MaxStringContentLength This quota limits the maximum string size that the XML reader returns. This quota does not limit memory consumption in the XML reader itself, but in the component that is using the reader. For example, when the DataContractSerializer uses a reader secured with MaxStringContentLength, it does not deserialize strings larger than this quota. When using the XmlDictionaryReader class directly, not all methods respect this quota, but only the methods that are specifically designed to read strings, such as the ReadContentAsString method. The Value property on the reader is not affected by this quota, and thus should not be used when the protection this quota provides is necessary.

It limits the maximum size of a string that is returned, either an XML string or a method that returns a string.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top