Skip to main content
Retrieving huge amount of data from WCF service in Silverlight application
Entry Date: Rate:
Site:
Keywords:
RSS Description:
Today, I was trying to figure out why my WCF service call was always throwing the generic NotFound exception when trying to retrieve large datasets. I had all the buffer limits set to 2147483647 (int.MaxValue) at Silverlight service configuration file as well as WCF service configuration section under web.config. Some more analysis revealed that I was getting a System.Net.WebException, saying: The underlying connection was closed: The connection was closed unexpectedly. After some research, I found that I need to set the maxItemsInObjectGraph for dataContractSerializer to some higher value in my web.config.
Comments:

If you have to send big packets on your WCF service calls first thing about chopping them and use several calls to complete the sending... if you cannot go for that, or don't have time to implement it, or for instance your app is running in an intranet, you can tweak something (Silverlight Application, server side web.config) to accept bigger requests (serialization maxgraph, plus packet size, plus timeout defaults plus httpRunTime default settings).

Following the steps of this article you will get it working.