This happened when I was sending large chunks of data through a WCF service -- by default it seems that the service is configured not accept anything over a certain size, probably as a security measure.
Overriding it is done by adding a "readerQuotas" section:
<bindings>
<basicHttpBinding>
<binding maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
Drawn from this blog:
http://www.megustaulises.com/2012/04/wcf-common-error-messages-tips-and.html?_escaped_fragment_="
A word of caution, though -- in most examples I found in Google there was an admonition to add a "name" attribute to the "binding" element (e.g., http://stackoverflow.com/questions/3068076/wcf-service-the-maximum-array-length-quota-16384-has-been-exceeded) and if you use the "Edit WCF Configuration" utility in Visual Studio 2010 it'll actually say there's an error when it senses that the "name" attribute is missing.
This has confused more people than just me -- see https://go4answers.webhost4life.com/Example/maximum-array-length-quota-16384-36456.aspx, especially "Answer 6". It seems that if the "name" attribute is left out then the change is made to the global binding definition if the WCF project is .NET 4.0+.
The confusion would seem to come from an improvement in the structure of WCF config files introduced in .NET 4.0/4.5 as a "simplification" feature, documented in http://msdn.microsoft.com/en-us/library/hh309266.aspx
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment