tags:

views:

27

answers:

1

I have a wcf service which returns a list of many objects e.g. 100,000

I get an error when calling this function because the maximum size i am allowed to pass back from wcf has been exceeded.

Is there a built in way i could return this in smaller chunks e.g. 20,000 at a time

I can increase the size allowed back from the wcf but was wondering what the alternatives were.

Thanks

A: 

Without knowing your requirements, I'd take a look at two other possible options:

  1. Paging: If your 100,000 objects are coming from a database, then use paging to reduce the amount of data and invoke the service in batches with a page number. If the objects are not coming from a database, then you'd need to look at how that data will be stored server-side during invocations.
  2. Streaming: Return the data to the caller as a stream instead.

With the streaming option, you'd have to do some more work in terms of managing the serialization of the objects, but it would allow the client to 'pull' the objects from the service at its own pace. Streaming is supported in most, if not all, the standard bindings (including HTTP).

Tim Roberts