error deserializing the object of type System.String. The maximum string content length quota (8192) has been exceeded while reading XML data. RRS feed

  • Question

  • User343518559 posted


    I am passing an encrypted XML data from a windows service to a WCF.

    While passing small xml data it works fine, but if i am trying to pass a bigger data an exception occurs at the instance of calling WCF method and assigning parameters to it.

    Exception is;

    The formatter threw an exception while trying to deserialize the message: 
    There was an error while trying to deserialize parameter http://tempuri.org/:XMLData. The InnerException message was
    'There was an error deserializing the object of type System.String. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the
    XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 11982.'. Please see InnerException for more details.

    Plz help me...its urgent....

    Monday, March 18, 2013 9:31 AM


All replies

  • User1291589676 posted

    Increase you serialization size in your webconfig as below,

      <binding name="BasicHttpBinding_MyApplication" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="true" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="1000000" maxBufferPoolSize="524288" maxReceivedMessageSize="1000000"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        <security mode="TransportCredentialOnly">
          <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
          <message clientCredentialType="UserName" algorithmSuite="Default" />
            <behavior name="BasicHttpBinding_MyApplication">
              <dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483647" />        

    Monday, March 18, 2013 9:35 AM
  • User343518559 posted

    Here is my config section;

            <binding name="BasicHttpBinding_IService1" closeTimeout="00:30:00"
              openTimeout="00:30:00" receiveTimeout="00:10:00" sendTimeout="00:30:00"
              allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
              maxBufferSize="20481000" maxBufferPoolSize="524288" maxReceivedMessageSize="20481000"
              messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
              <security mode="None">
                <transport clientCredentialType="None" proxyCredentialType="None"
                  realm="" />
                <message clientCredentialType="UserName" algorithmSuite="Default" />
          <endpoint address="http://localhost:51611/Service1.svc" binding="basicHttpBinding"
            bindingConfiguration="BasicHttpBinding_IService1" contract="SMSWeb.IService1"
            name="BasicHttpBinding_IService1" />

    Monday, March 18, 2013 9:37 AM
  • User343518559 posted

    i just tried your first post,but no way..

    the second link describes something vastly far away from my topic

    Monday, March 18, 2013 9:52 AM
  • User-1000095884 posted


    If your service is hosted in ASP.NET/IIS web application, you also need to increase the value of  "maxRequestLength" attribute of the <httpRuntime> element (under <system.web> section).

    #httpRuntime Element (ASP.NET Settings Schema)


    If the issue still exists, I would suggest you enable tracing for your service to help to dignose the issue.

    #How to enable WCF tracing


    Best Regards.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 20, 2013 6:04 AM