WCF - The maximum string content length quota (8192) has been exceeded while reading XML data - Anuj Varma, Hands-On Technology Architect, Clean Air Activist (2024)

Introduction

The DataContractSerializer in WCF serializes objects to XML Streams. There is a size (length) limitation on these streams. They are restricted by default to 8k (8192 bytes).

While this helps in avoiding Denial of Service (DoS) attacks, it is an incovenience for several service operations that DO return LARGER than 8k size objects. The resultset from a single query returned by a WCF service could constitute one such large object. When this happens, the WCF runtime throws an exception:


The maximum string content length quota (8192) has been exceeded while reading XML data.

To work around this limitation, certain web.config values need to be tweaked – both, on the client web.config as well as the server. Just having a client SEND a large message – without the server web.config configured to ACCEPT the message, will just throw a different exception. One needs to tweak both in conjunction as described below:

<bindings> 
 <basicHttpBinding>
 <binding name="basicHttpConfiguration" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
 <readerQuotas maxStringContentLength="2147483647" />
 </binding>
 </basicHttpBinding>
 </bindings> 

Server Side web.config Summary

  1. maxStringContentLength
  2. maxBufferSize
  3. maxReceivedMessageSize

<system.serviceModel>
 <bindings>
 <basicHttpBinding>
 <binding name="RequestProcessorBinding" receiveTimeout="00:30:00" sendTimeout="00:01:00"
 maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
 maxReceivedMessageSize="2147483647">
 <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096"
 maxNameTableCharCount="16384" />
 </binding>
 </basicHttpBinding>
 </bindings>
 <client>
 <endpoint address="http://www.mydomain.com/wcfservice/MyService.svc"
 binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService"
 contract="MyWcfServiceReference.IMyService" name="BasicHttpBinding_IMyService" />
 </client>
 </system.serviceModel>

Client Side web.config Summary

  1. maxStringContentLength
  2. maxBufferSize
  3. maxBufferPoolSize
  4. maxReceivedMessageSize
  5. maxStringContentLength

Anuj holds professional certifications in Google Cloud, AWS as well as certifications in Docker and App Performance Tools such as New Relic. He specializes in Cloud Security, Data Encryption and Container Technologies.

Initial Consultation

Anuj Varma – who has written posts on Anuj Varma, Hands-On Technology Architect, Clean Air Activist.

WCF - The maximum string content length quota (8192) has been exceeded while reading XML data - Anuj Varma, Hands-On Technology Architect, Clean Air Activist (1)WCF - The maximum string content length quota (8192) has been exceeded while reading XML data - Anuj Varma, Hands-On Technology Architect, Clean Air Activist (2)

WCF - The maximum string content length quota (8192) has been exceeded while reading XML data - Anuj Varma, Hands-On Technology Architect, Clean Air Activist (2024)
Top Articles
Mindful eating: A key to better health and weight loss
Forex trading examples
Scheelzien, volwassenen - Alrijne Ziekenhuis
Hotels Near 6491 Peachtree Industrial Blvd
Xre-02022
Worcester Weather Underground
Cappacuolo Pronunciation
It may surround a charged particle Crossword Clue
Air Canada bullish about its prospects as recovery gains steam
Devotion Showtimes Near Mjr Universal Grand Cinema 16
Byrn Funeral Home Mayfield Kentucky Obituaries
Hk Jockey Club Result
David Packouz Girlfriend
Nikki Catsouras Head Cut In Half
Volstate Portal
Osrs Blessed Axe
Culos Grandes Ricos
David Turner Evangelist Net Worth
Google Feud Unblocked 6969
Tcu Jaggaer
Images of CGC-graded Comic Books Now Available Using the CGC Certification Verification Tool
라이키 유출
Spider-Man: Across The Spider-Verse Showtimes Near Marcus Bay Park Cinema
Unterwegs im autonomen Freightliner Cascadia: Finger weg, jetzt fahre ich!
Www.paystubportal.com/7-11 Login
Lbrands Login Aces
Ncal Kaiser Online Pay
Himekishi Ga Classmate Raw
Ugly Daughter From Grown Ups
Helloid Worthington Login
Warn Notice Va
Missing 2023 Showtimes Near Mjr Southgate
Autopsy, Grave Rating, and Corpse Guide in Graveyard Keeper
Flaky Fish Meat Rdr2
Watchdocumentaries Gun Mayhem 2
Colorado Parks And Wildlife Reissue List
Srg Senior Living Yardi Elearning Login
Jewish Federation Of Greater Rochester
Hazel Moore Boobpedia
Arch Aplin Iii Felony
5103 Liberty Ave, North Bergen, NJ 07047 - MLS 240018284 - Coldwell Banker
A jovem que batizou lei após ser sequestrada por 'amigo virtual'
25100 N 104Th Way
Game Like Tales Of Androgyny
Peugeot-dealer Hedin Automotive: alles onder één dak | Hedin
28 Mm Zwart Spaanplaat Gemelamineerd (U999 ST9 Matte | RAL9005) Op Maat | Zagen Op Mm + ABS Kantenband
How Did Natalie Earnheart Lose Weight
Inside the Bestselling Medical Mystery 'Hidden Valley Road'
Asisn Massage Near Me
Latest Posts
Article information

Author: Greg O'Connell

Last Updated:

Views: 6250

Rating: 4.1 / 5 (42 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Greg O'Connell

Birthday: 1992-01-10

Address: Suite 517 2436 Jefferey Pass, Shanitaside, UT 27519

Phone: +2614651609714

Job: Education Developer

Hobby: Cooking, Gambling, Pottery, Shooting, Baseball, Singing, Snowboarding

Introduction: My name is Greg O'Connell, I am a delightful, colorful, talented, kind, lively, modern, tender person who loves writing and wants to share my knowledge and understanding with you.