Simonc74
asked on
WCF - The maximum array length quota (16384) has been exceeded while reading XML data
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=1.0.0.0, 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:
<basicHttpBinding>
<binding name="BasicHttpBinding_IUp loadServic e" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="St rongWildca rd"
maxBufferSize="65536000" maxBufferPoolSize="5242880 00" maxReceivedMessageSize="65 536000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32000" maxStringContentLength="81 92000" maxArrayLength="16384000"
maxBytesPerRead="4096000" maxNameTableCharCount="163 84000" />
<security mode="None">
<transport clientCredentialType="None " proxyCredentialType="None"
realm="" />
<message clientCredentialType="User Name" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
I'm using the binding for my endpoint configuration;
<client>
<endpoint address="http://localhost:52980/UploadService.svc"
binding="basicHttpBinding" bindingConfiguration="Basi cHttpBindi ng_IUpload Service"
contract="myService.IUploa dService" name="BasicHttpBinding_IUp loadServic e" />
</client>
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?
"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
This is how my binding looks on the client app.config file:
<basicHttpBinding>
<binding name="BasicHttpBinding_IUp
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false"
maxBufferSize="65536000" maxBufferPoolSize="5242880
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32000" maxStringContentLength="81
maxBytesPerRead="4096000" maxNameTableCharCount="163
<security mode="None">
<transport clientCredentialType="None
realm="" />
<message clientCredentialType="User
</security>
</binding>
</basicHttpBinding>
I'm using the binding for my endpoint configuration;
<client>
<endpoint address="http://localhost:52980/UploadService.svc"
binding="basicHttpBinding"
contract="myService.IUploa
</client>
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?
ASKER
Posting the complete server side config file...
Web.config
Web.config
The reader quotas between client and server config files does not match.
Both binding configurations must be the same.
Both binding configurations must be the same.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
If you have defined your server binding configuration, then I think you are missing service binding section in the server config file, check:
http://scorpiotek.com/blog/?p=393
http://stackoverflow.com/questions/464707/maximum-array-length-quota