c# - Fixing maximum length quota on XmlDictionaryReaderQuotas for WCF 4.0 REST -
wcf 4.0 rest projects return 400 bad request errors if post body greater 8192 characters in length. default value of xmldictionaryreaderquotas.maxstringcontentlength property. xmldictionaryreader class used in deserialization process, json messages.
i've seen many examples of how solve wcf custom bindings , endpoints, no solution wcf 4.0 rest projects, uses simplified configuration.
the normal web.config file contains section looks this:
<system.servicemodel> <servicehostingenvironment aspnetcompatibilityenabled="true"/> <standardendpoints> <webhttpendpoint> <standardendpoint name="" helpenabled="true" automaticformatselectionenabled="true" /> </webhttpendpoint> </standardendpoints> </system.servicemodel>
first, message size needs increased. that, add maxreceivedmessagesize standardendpoint.
<standardendpoint name="" helpenabled="true" automaticformatselectionenabled="true" maxreceivedmessagesize="65535" />
to set maxstringcontentlength, add following system.servicemodel section:
<bindings> <webhttpbinding> <binding> <readerquotas maxstringcontentlength="65535"/> </binding> </webhttpbinding> </bindings>
you'll need set length value suitable environment.
Comments
Post a Comment