Click here to Skip to main content
15,885,890 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All, I am building WCF service (hosted on IIS) that retrieves nearly 2,50,000 records from database. Currently I am trying with basicHttpBinding and wsHttpBinding binding but getting following errors 'Connection was closed forcefully' or 'An error occurred while receiving the HTTP response to http://localhost:8093/Service.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details' I googled it and try different options like incresing maxBufferSize, maxReceivedMessageSize, using readerQuotas, also sets maxItemsInObjectGraph in dataContractSerializer etc etc but none of these help me. Please reply with the solution.
Can JSON help me in this scenario?
Posted

1 solution

Your issue is more about the overall design rather than of WCF.
Retrieving such a huge dataset at one go will obviously overload the entire infrastructure, from memory to bandwidth.

However if you really want to do so, setup a chunking channel wherein the service will fetch the data in small chunks, say 10K records so you need buffer for only this much. The service will have the connection till the entire operation gets completed, whereas buffer overrun / timeout will not happen.

Following links explain the concept in more detail.

msdn.microsoft.com/en-us/library/aa717050.aspx
stackoverflow.com/questions/323585/wcf-chunking-streaming
http://mark-csharp.blogspot.in/2009/01/wcf-file-transfer-streaming-chunking.html
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900