Click here to Skip to main content
15,879,326 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
<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
    <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>
    <system.serviceModel>
      <bindings>
        <basicHttpBinding>
          <binding name="BasicHttpBinding_IImageTest" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
            <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647"/>
          </binding>
        </basicHttpBinding>
      </bindings>
      <behaviors>
            <serviceBehaviors>
                <behavior name="">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
</configuration>



and my ServiceReference.Config file is:

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



Help me in this

Thanks in advance
Posted

1 solution

Increase the maxItemsInObjectGraph quota.

XML
<behavior>
    <serviceMetadata httpGetEnabled="true"/>
    <serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="6553600"/> <!--You can set this upto 2,147,483,647-->
  </behavior>
 
Share this answer
 
Comments
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