413 Request Entity Too Large when connecting to a WCF service

Published Feb 08 2019 03:37 PM 7,852 Views
Microsoft

Error "413 Request Entity Too Large" when connecting to a WCF service.

 

Increase maxReceivedMessageSize and readerQuotas to resolve the error. Below is an example:

 

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding maxReceivedMessageSize="10485760">
<readerQuotas maxDepth="32" maxBytesPerRead="200000000" maxArrayLength="200000000" maxStringContentLength="200000000" />
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>

2 Comments
%3CLINGO-SUB%20id%3D%22lingo-sub-333384%22%20slang%3D%22en-US%22%3E413%20Request%20Entity%20Too%20Large%20when%20connecting%20to%20a%20WCF%20service%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-333384%22%20slang%3D%22en-US%22%3E%3CP%3EError%20%22413%20Request%20Entity%20Too%20Large%22%20when%20connecting%20to%20a%20WCF%20service.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIncrease%26nbsp%3BmaxReceivedMessageSize%20and%26nbsp%3BreaderQuotas%20to%20resolve%20the%20error.%20Below%20is%20an%20example%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSYSTEM.SERVICEMODEL%3E%3CBR%20%2F%3E%3CBINDINGS%3E%3CBR%20%2F%3E%3CBASICHTTPBINDING%3E%3CBR%20%2F%3E%3CBINDING%20maxreceivedmessagesize%3D%22%26quot%3B10485760%26quot%3B%22%3E%3CBR%20%2F%3E%3CREADERQUOTAS%20maxdepth%3D%22%26quot%3B32%26quot%3B%22%20maxbytesperread%3D%22%26quot%3B200000000%26quot%3B%22%20maxarraylength%3D%22%26quot%3B200000000%26quot%3B%22%20maxstringcontentlength%3D%22%26quot%3B200000000%26quot%3B%22%3E%3C%2FREADERQUOTAS%3E%3CBR%20%2F%3E%3C%2FBINDING%3E%3CBR%20%2F%3E%3C%2FBASICHTTPBINDING%3E%3CBR%20%2F%3E%3C%2FBINDINGS%3E%20%3CBR%20%2F%3E%3C%2FSYSTEM.SERVICEMODEL%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-333384%22%20slang%3D%22en-US%22%3E%3CP%3EError%20%22413%20Request%20Entity%20Too%20Large%22%20when%20connecting%20to%20a%20WCF%20service.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIncrease%26nbsp%3BmaxReceivedMessageSize%20and%26nbsp%3BreaderQuotas%20to%20resolve%20the%20error.%20Below%20is%20an%20example%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSYSTEM.SERVICEMODEL%3E%3CBR%20%2F%3E%3CBINDINGS%3E%3CBR%20%2F%3E%3CBASICHTTPBINDING%3E%3CBR%20%2F%3E%3CBINDING%20maxreceivedmessagesize%3D%22%26quot%3B10485760%26quot%3B%22%3E%3CBR%20%2F%3E%3CREADERQUOTAS%20maxdepth%3D%22%26quot%3B32%26quot%3B%22%20maxbytesperread%3D%22%26quot%3B200000000%26quot%3B%22%20maxarraylength%3D%22%26quot%3B200000000%26quot%3B%22%20maxstringcontentlength%3D%22%26quot%3B200000000%26quot%3B%22%3E%3C%2FREADERQUOTAS%3E%3CBR%20%2F%3E%3C%2FBINDING%3E%3CBR%20%2F%3E%3C%2FBASICHTTPBINDING%3E%3CBR%20%2F%3E%3C%2FBINDINGS%3E%20%3CBR%20%2F%3E%3C%2FSYSTEM.SERVICEMODEL%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-333384%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Ehuanchix%40microsoft.com%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-334032%22%20slang%3D%22en-US%22%3ERe%3A%20413%20Request%20Entity%20Too%20Large%20when%20connecting%20to%20a%20WCF%20service%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-334032%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F237412%22%20target%3D%22_blank%22%3E%40Jason%20Xu%3C%2FA%3E%20for%20the%20post%20-%20It%20is%20important%20to%20consider%20if%20it%20makes%20sense%20to%20increase%20these%20binding%20default%20values.%20From%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fdotnet%2Fapi%2Fsystem.servicemodel.basichttpbinding.readerquotas%3Fview%3Dnetframework-4.0%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Edocumentation%3C%2FA%3E%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSTRONG%3EMaxReceivedMessageSize%3C%2FSTRONG%3E%20-%26nbsp%3Bthe%20maximum%20size%2C%20in%20bytes%2C%20for%20a%20message%20that%20can%20be%20received%20on%20a%20channel%20configured%20with%20this%20binding%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSTRONG%3EreaderQuotas%26nbsp%3B%3C%2FSTRONG%3E-%20this%20complex%20object%20sets%20constraints%26nbsp%3Bon%20the%20complexity%20of%20SOAP%20messages%20that%20can%20be%20processed%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSTRONG%3EmaxDepth%3C%2FSTRONG%3E%20-%20maximum%20nested%20node%20depth%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSTRONG%3EmaxStringContentLength%3C%2FSTRONG%3E%20-%26nbsp%3B%26nbsp%3Bthe%20maximum%20string%20length%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSTRONG%3EmaxArrayLength%3C%2FSTRONG%3E%20-%26nbsp%3Bthe%20maximum%20allowed%20array%20length%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ESo%2C%20if%20the%20particular%20scenario%20should%20not%20receive%20messages%20that%20contain%20unusually%20large%20strings%20or%20large%20number%20of%20arrays%2C%20then%20it%20is%20valid%20to%20reject%20messages%20that%20contain%20these.%20For%20example%2C%20if%20I%20have%20a%20message%20that%20contains%20a%20list%20of%20addresses.%20If%20the%20system%20in%20question%20only%20can%20have%2010%20addresses%20then%20why%20should%20the%20service%20receive%20messages%20that%20contain%20hundreds%20or%20thousands%20of%20addresses%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-333707%22%20slang%3D%22en-US%22%3ERe%3A%20413%20Request%20Entity%20Too%20Large%20when%20connecting%20to%20a%20WCF%20service%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-333707%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%2C%20That%20helps%20me%3C%2FP%3E%3C%2FLINGO-BODY%3E
Version history
Last update:
‎Feb 08 2019 03:37 PM
Updated by: