Last week I had a famous WCF error message stating that the message string length was too not large enough making it appear to be an issue with the behaviors or bindings being set to default. The error I was receiving was as shown below:
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:queryDTO. The InnerException message was ‘There was an error deserializing the object of type Service.UserAnalyticsLibrary.QueryDTO. 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. Line 1, position 19142.’. Please see InnerException for more details.
The portion
“There was an error deserializing the object of type Service.UserAnalyticsLibrary.QueryDTO. The maximum string content length quota (8192) has been exceeded while reading XML data.”
is the key here (or was supposed to be). This turned out after several crapy days to be a red herring. Don’t we all just love those? It actually turned out that the portion that was an issue was the dataserializer itself. Adding this line to the bindings fixed the issue:
One thing to note here is that when you are adding these new properties to change the defaults, YOU MUST GIVE EVERYTHING A NAME. If you do not give your behaviors and bindings a name, the default will be selected regardless of what you enter in the bindings properties.
Happy Coding 🙂