0

I called an WCF service and tried fetching data from database in windows 7. I got this error.

Error in deserializing body of reply message for operation 'GetProductXml'. 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 13, position 197.

I tried changing the MaxStringContentLength property to 2147483647 in web config of WCF service but i get the same above error....

2 Answers 2

2

You need to change it in the client.config file that was created when you added a service reference in your windows 7 application.

Sign up to request clarification or add additional context in comments.

Comments

0

You can get around the error by adding the below settings in your WCF Service web.config and also on your client side web.config:

<basichttpBinding>
    <binding>
        <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="64" maxNameTableCharCount="2147483647" />
    </binding>
</basichttpBinding>

NOTE: Assuming you are using BasicHttpBinding. If using a different binding make sure to add the readerQuotas for that binding.

If you are hosting your WCF service via code and then you want to add reader quotas via code see below:

var binding = new BasicHttpBinding();
var myReaderQuotas = new XmlDictionaryReaderQuotas();
myReaderQuotas.MaxStringContentLength = 5242880;
binding.GetType().GetProperty("ReaderQuotas").SetValue(binding, myReaderQuotas, null); 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.