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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -