Thursday, April 9, 2009

WCF Errors

Scenario:
Past week I was working on a new WCF service and encountered following errors

Error 1:
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.'. Please see InnerException for more details.

Error 2:
The maximum nametable character count quota (16384) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader

Error 3:
The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'XYZ'. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader

Solution:
All the above errors are related to the way Server and Client side binding configuration are set. Make sure you have same values on both side.

Error 1 : MaxArrayLength default value is 16384 , try increasing it to a bigger value.

Error 2 : MaxNameTableCharCount default value is 16384 , try increasing it to a bigger value.

Error 3 : MaxStringContentLength default value is 8192, try increasing it to a bigger value.

4 comments:

Sandeep September 17, 2009 at 1:30 PM  

what didn't work for u ? also which one of error are u getting ?

Ajay April 9, 2010 at 1:20 AM  

The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'functionname'. 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.... functionname inserts value to a image field... I tried increasing the maximum array length to 2147483647 on the client side, but still the same 16384 error occurs.. please help...

Sunny Sethi,  October 7, 2010 at 11:59 AM  

where these settings has to be provided.
Some of the blogs says it has to be on the server side.
I have tried providing on server side and the client side but it doesn't work.