Fixing MaxItemsInObjectGraph quota Error in WCF Service
Date Published: 28 April 2011
I have a WCF Service that occasionally yields a message like this one:
Maximum number of items that can be serialized or deserialized in an object graph is ‘65536’. Change the object graph or increase the MaxItemsInObjectGraph quota.
Today isn’t the first time I’ve run into this message – I’ve fixed this issue before – but since this is the 2nd or more time I’ve run into it, I thought I’d post a quick resolution here so I can find it again later myself, and perhaps help some others. There’s a rather long forum thread on this subject that ultimately includes the solution, but digging it out is a bit painful as is the case with so many forum threads, so I’ll sum up here and just give you what you need.
First, you need to realize that to resolve this issue you will need configuration elements to be specified on both the client and the server. In both cases, the configuration you are looking for is going to be in a named
I notice that my
Once you have these beautiful and extremely intuitive blocks of user-friendly XML in place, your WCF stuff should magically work again with larger than 65536 object graph sizes! Enjoy!
Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.