Click here to Skip to main content
14,640,713 members
Rate this:
Please Sign up or sign in to vote.
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
  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:

<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

Rate this:
Please Sign up or sign in to vote.

Solution 1

Increase the maxItemsInObjectGraph quota.

<behavior>
    <serviceMetadata httpGetEnabled="true"/>
    <serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="6553600"/> <!--You can set this upto 2,147,483,647-->
  </behavior>
   
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100