Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


WCF - The maximum array length quota (16384) has been exceeded while reading XML data

Posted on 2012-08-20
Medium Priority
Last Modified: 2012-09-11
I created a wcf service application which fails when uploading large amounts of data (max 5-10 MB) for the following reason:

"The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:data. The InnerException message was 'There was an error deserializing the object of type System.Collections.Generic.List`1 [[..., myService, Version=, Culture=neutral, PublicKeyToken=null]]. 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. Line 1, position...'.

This is how my binding looks on the client app.config file:

        <binding name="BasicHttpBinding_IUploadService" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="65536000" maxBufferPoolSize="524288000" maxReceivedMessageSize="65536000"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          <readerQuotas maxDepth="32000" maxStringContentLength="8192000" maxArrayLength="16384000"
            maxBytesPerRead="4096000" maxNameTableCharCount="16384000" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />

I'm using the binding for my endpoint configuration;

      <endpoint address="http://localhost:52980/UploadService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUploadService"
        contract="myService.IUploadService" name="BasicHttpBinding_IUploadService" />

I've updated the server side configuration although when I update the service reference it still reverts back to the default maxArrayLength, etc.

I can upload small amounts of data successfully so I know it's not a bug in the code.

Furthermore the application doesn't send a request to the service when uploading large amounts of data which suggests an issue on the client side?
Question by:Simonc74
  • 3
  • 2
LVL 36

Expert Comment

by:Miguel Oz
ID: 38311469
Can you post your complete server side config file?
If you have defined your server binding configuration, then  I think you are missing service binding section  in the server config file, check:

Author Comment

ID: 38311510
Posting the complete server side config file...
LVL 36

Expert Comment

by:Miguel Oz
ID: 38318452
The reader quotas between client and server config files does not match.
Both binding configurations must be the same.

Accepted Solution

Simonc74 earned 0 total points
ID: 38372075
I ended up re-creating the wcf service aplication.

I updated the web.config using the WCF Service Configuration Editor (right click on web.config > "Edit WCF Cnofiguration") I would advise using the configuration editor if experiencing the same problem.

Author Closing Comment

ID: 38385997
This is the solution I used in order to solve the problem I was having. While the other posts were helpful they failed to resolve my problem. I had already tried the suggested solutions prior to the posts being added

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month12 days, 11 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question