Thursday, September 24, 2009

Passing Large Arrays (Lists) Via WCF

Was getting the error "The underlying connection was closed: The connection was closed unexpectedly" when passing arrays from large datasets to the client.

This is the solution:

http://consultingblogs.emc.com/merrickchaffer/archive/2007/09/19/WCF-System.Net.WebException_3A00_-The-underlying-connection-was-closed_3A00_-The-connection-was-closed-unexpectedly.aspx

Basically requires adding the following to both the server and the client config files (web.config / app.config)

<dataContractSerializer maxItemsInObjectGraph="2147483646"/>