"Error in deserializing body of reply message for operation '<operation-name>'. The 'maximum bytes per Read operation' quota (<quota-value>) has been exceeded while reading XML data. Long element start tags (consisting of the element name, attribute names and attribute values) may trigger this quota. This quota may be increased by changing the MaxBytesPerRead property on the XmlDictionaryReaderQuotas object used when creating the XML reader."
Larger and smaller amount of data will process without errors and only a few combinations will fail. If you change MaxBytesPerRead quotas you will succeed with the values you have failed initially and fail with different data sizes.
You cannot reproduce this problem using an encoding that is not binary or if the transfer mode is buffered.
Workaround 1: Port the service to WCF 4.0
If all possible, the best way to resolve the issue is to port the application to WCF 4.0. The issue does not exist in WCF 4.0 RTM and beyond.
Workaround 2: Use an encoding different than binary
This issue happens at XmlBinaryReader level only which is part of binary encoding. No other encoding will cause the issue.
Workaround 3: Use buffered transfer mode
The issue only happens in streamed transfer mode with binary encoding.
Workaround 4: Change the MaxBytesPerRead quota to match MaxBufferSize
This solution must be considered carefully to avoid a large MaxBytesPerRead value that may cause the application to be more vulnerable to attacks where the attacker sends large start element tags
Article ID: 2735572 - Last Review: 17 Jul 2012 - Revision: 1