Click here to Skip to main content
15,882,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
a:DeserializationFailedThe formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'ImageInsert'. 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 63953.

I get the above error while trying to transfer a image through WCF Service.

Webconfig file :

<?xml version="1.0"?>
  For more information on how to configure your ASP.NET application, please visit
        <compilation debug="true" targetFramework="4.0" />
          <binding name="BasicHttpBinding_IImageTest" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
            <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647"/>
                <behavior name="">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

and my ServiceReference.Config file is:

              <binding name="BasicHttpBinding_IImageTest">
                <security mode="None" />
            <endpoint address="http://localhost:1177/ImageTest.svc" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IImageTest" contract="ImageTest.IImageTest"
                name="BasicHttpBinding_IImageTest" />

Help me in this

Thanks in advance

1 solution

Increase the maxItemsInObjectGraph quota.

    <serviceMetadata httpGetEnabled="true"/>
    <serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="6553600"/> <!--You can set this upto 2,147,483,647-->
Share this answer
rajesh1231103 29-Nov-10 22:15pm    
Now i'm getting different error "HTTP/1.1 400 Bad Request"
after adding maxItemsInObjectGraph in the web.config

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900