wpf maximum string length quota 8192 has been exceeded Edit

Pooran Prasad Rajanna | 09 September 2020 | 798

If you get ‘The maximum string content length quota (8192) has been exceeded while reading XML data' error from WCF service, it is because the output has restrictions in web.config of client application.

Go ahead and set maxReceivedMessageSize, maxStringContentLength, maxDepth, maxArrayLength sizes to the max possible 2147483647 in client application's (WPF / Silverlight / ASP.Net ) web.config/app.config.

<system.serviceModel>
        <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IAdwService"
            bypassProxyOnLocal="false"
            transactionFlow="false"
            hostNameComparisonMode="StrongWildcard"
            maxBufferPoolSize="524288"
            maxReceivedMessageSize="2147483647"
            messageEncoding="Text"
            textEncoding="utf-8"
            useDefaultWebProxy="true">
                <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4012" maxNameTableCharCount="8192"
                />
                <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
                <security mode="Message">
                    <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
                    <message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="true" />
                </security>
            </binding>
        </wsHttpBinding>


Do not unnecessarily increase the value as it might defeat the purpose under DOS attacks.