Passing Large and Complex objects in WCF
Generally WCF has no restrictions on the maximum size of the message that can be passed across the wire. Technically speaking, the maximum size of a message that can be passed and processed in a typical WCF communication is about 9,223,372,036,854,775,807 bytes (which is about 8.5 billion GB!). That is, only if you explicity allow the WCF service and client to receive messages of such sizes. However, there are certain caveats to keep in mind.
For most part, it is possible to set maxReceivedMessageSize attribute to a large value (the defualt being 64KB) to get it going. If a plain large object (say of size 22 MB) is serialized while sending across the wire, it would work just as well as it may not have objects nested within one another. But in cases where there are too many nested objects, with many nested Lists containing a large number of items (say 10,000) embedded, then the number of objects going across the wire crosses the default limit of 65,536.
This restriction is placed to prevent Denial of Service attacks. But by configuring dataContractSerializer you can pass such complex objects of large sizes. This attibute is not available through the bindings, but actually as an extension of the service and endpoint behavior. The value needs to be set in both the client and the server.
Client
<endpointBehaviors>
<behavior name="ClientBehavior">
<dataContractSerializer maxItemsInObjectGraph="10000000"/>
</behavior>
</endpointBehaviors>
Server
<serviceBehaviors>
<behavior name="HostBehavior">
<dataContractSerializer maxItemsInObjectGraph="10000000"/>
</behavior>
<serviceBehaviors>
Once this behavior is set, the WCF service and client can send and receive not only large objects, but also highly complex ones.

Comments
Hi,
What is the limitation on web client? This seems to work well in windows client environment. But can you suggest what can we do for web client to transfer maximum data?
Posted by: Sridhar Joies | October 13, 2008 03:43 PM