Reputation: 4427
My MVC3 app calls a WCF service to download/upload files. The WCF service calls an old school asmx service to either get the base 64 string of the file requested (download), or receive the base 64 string of a file (upload). I can download files to my machine of any size just fine.
When i try to upload a file i get the dreaded max array length error:
The maximum array length quota (16384) has been exceeded while reading XML data.
This quota may be increased by changing the MaxArrayLength property on the
XmlDictionaryReaderQuotas object used when creating the XML reader.
The confusing part about this is i'm using the same service to download files as I am to upload them. So I should get that error on both but i dont. I have this in my web.config:
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="2147483647"/>
So why am i able to download files but not upload them? Thanks
Upvotes: 0
Views: 206
Reputation: 6825
You need to make sure the maxArrayLength is set in both your calling app's app/web.config file and the WCF service's web.config file. If hosted in IIS 7+, you may also need to adjust the IIS Request Filtering settings. In IIS, go to the Request Filtering feature for the server/site/application you want to configure. In here, there's an Edit Feature Settings action in the right pane options. Choose that, and then set the Maximum allowed content length value here as well.
Upvotes: 1