locked
WCF HttpBinding ReaderQuota RRS feed

  • Question

  • Hi,

    I have exposed a service using http binding and I have mentioned the reader quota array length as 2147483647 as mentioned below.

    <binding name="messageBindingConfig" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
        <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="None" />
        </security>
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
    

    And the service config entry as follows

    <service behaviorConfiguration="ABCServiceBehavior" name="ABCService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="messageBindingConfig" contract="IABCService"/>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
    </service>
    


    But when I called the service with the higher length, it is throwing the error as "The maximum array length quota 16384 has been exceeded". i.e., it is not considering the given array length instead it is considering the default value alone.

    Please let me know what I have missed in the above configuration.

    Thanks and Regards,


    Vijay Pandurangan
    Monday, September 12, 2011 10:27 AM

Answers

  • Hi All,

    Thanks for replying.

    The problem is not with the configuration. The entries are correct. But the configuration is added in the root level, where the service looked into the web.config of the virtual application directory. When I applied the above entries in Virtual Application directory. It started working fine.

    Thanks and Regards,


    Vijay Pandurangan
    • Marked as answer by Yi-Lun Luo Friday, September 16, 2011 9:08 AM
    Tuesday, September 13, 2011 5:26 AM

All replies

  • On 9/12/2011 6:27 AM, Vijay_Pandurangan wrote:
    > Hi,
    >
    > I have exposed a service using http binding and I have mentioned the
    > reader quota array length as 2147483647 as mentioned below.
    >
    > <binding  name="messageBindingConfig"  maxBufferPoolSize="2147483647"  maxBufferSize="2147483647"  maxConnections="10"  maxReceivedMessageSize="2147483647">
    >      <security  mode="TransportWithMessageCredential">
    >          <transport  clientCredentialType="None"  />
    >      </security>
    >      <readerQuotas  maxDepth="2147483647"  maxStringContentLength="2147483647"  maxArrayLength="2147483647"  maxBytesPerRead="2147483647"  maxNameTableCharCount="2147483647"  />
    > </binding>
    >
    > And the service config entry as follows
    >
    > <service  behaviorConfiguration="ABCServiceBehavior"  name="ABCService">
    >      <endpoint  address=""  binding="basicHttpBinding"  bindingConfiguration="messageBindingConfig"  contract="IABCService"/>
    >      <endpoint  address="mex"  binding="mexHttpsBinding"  contract="IMetadataExchange"/>
    > </service>
    >
    >
    > But when I called the service with the higher length, it is throwing the
    > error as "The maximum array length quota 16384 has been exceeded". i.e.,
    > it is not considering the given array length instead it is considering
    > the default value alone.
    >
    > Please let me know what I have missed in the above configuration.
     
    Did you account for the client-side?
     
    Monday, September 12, 2011 10:53 AM
  • Hi,

    Yes the same configuration is applied in the client side too. (Given below for your reference)

     <basicHttpBinding>
            <binding name="BasicHttpBinding_IABCService" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
                     allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
                    maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
              <security mode="TransportWithMessageCredential">
                <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
                <message clientCredentialType="UserName" algorithmSuite="Default" />
              </security>
            </binding>
    </basicHttpBinding>
    

    Thanks and Regards,


    Vijay Pandurangan
    Monday, September 12, 2011 11:10 AM
  • enable Trace in WCF service and see the real error message.

    Try increasing maxItemsInObjectGraph as below and share your result.

                    <behavior name="ABC">
                        <serviceMetadata httpGetEnabled="true" />
                        <dataContractSerializer  maxItemsInObjectGraph="2147483647"/>
                    </behavior>
    

     


    Lingaraj Mishra
    Monday, September 12, 2011 12:31 PM
  • Hi All,

    Thanks for replying.

    The problem is not with the configuration. The entries are correct. But the configuration is added in the root level, where the service looked into the web.config of the virtual application directory. When I applied the above entries in Virtual Application directory. It started working fine.

    Thanks and Regards,


    Vijay Pandurangan
    • Marked as answer by Yi-Lun Luo Friday, September 16, 2011 9:08 AM
    Tuesday, September 13, 2011 5:26 AM