WCF Ria Services result set size limitation

While creating what should be a simple silverlight WCF RIA services application, the client returned the following error for some datasets:

System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed for query 'GetBins'. Value cannot be null.
Parameter name: validationErrors ---> System.ArgumentNullException: Value cannot be null.

By using firebug and limiting the size of the return dataset, it became evident that after a certain size, the dataset wasn't returned at all with the http package.
It turns out that this is a WCF RIA services configuration issue. The default value for MaxItemsInObjectGraph was something way below the total number of records returned.
The solution was to do one of two things: Set MaxItemsInObjectGraph to be some larger number either in the web.config, or in the domain service class definition itself as follows:

[ServiceBehavior(MaxItemsInObjectGraph = 2147483647)]
public class myDomainService : DomainService { ... }

Add that little gem to your domain services, and your problems melt away...

Comments

Hitesh Patel said…
Thanks Aaron,
This post is helpful to me.

Popular posts from this blog

KnockoutJS, WebAPI, and TypeScript

The most efficient algorithm to scan a bitmap