Reputation: 31
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....
Upvotes: 0
Views: 562
Reputation: 7876
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);
Upvotes: 0
Reputation: 38179
You need to change it in the client.config file that was created when you added a service reference in your windows 7 application.
Upvotes: 2