Returning large collections from WCF Serivce
Posted
by Nate Bross
on Stack Overflow
See other posts from Stack Overflow
or by Nate Bross
Published on 2010-05-07T16:02:46Z
Indexed on
2010/05/07
16:08 UTC
Read the original article
Hit count: 325
I'm trying to determine the best approach for building a WCF Service, and the area I'm struggling with most is returning lists of objects.
The built-in maxMessageSize of 64k seems pretty high, and I really don't want to bump it up (quick googling finds 100s of places bumping the maxMessageSize up to multi-gigabyte range which seems foolish). But, when I'm returning a collection of objects (~150 items) I am exceeding the default 64k.
I'm almost to the point of returning my own class which inherits IEnumerable and has properties for hasNext, hasPrevious and PageSize so that I can implement paging on the client side -- this seems like alot of code. The other option is to jackup the maxMessageSize and hope for the best, but that feels wrong.
All other aspects of my service are working great, its just returning large collectiosn where I'm having issues.
For background, there are two types of consumers of this service, UI applications which will be primarly web and/or wpf applications, and data processing applications, .NET console apps, and maybe some other non-UI apps. For the UI applications, I would like to keep them responsive and keep the messageSize low, on the console apps it doesn't matter as much as they are just pulling data down to do processing and push it back up to the service.
© Stack Overflow or respective owner