Click here to Skip to main content
15,882,795 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a Web Service and a Windows Form project that calls it. When called, the Web Service runs a process that can take a while and then returns a DataSet. I have a certain user who has been assigned to receive a much larger amount of data than others. He is occasionally getting the error “The underlying connection was closed: An unexpected error occurred on a receive.”

If we assign him the data in chunks, there are no errors. So I’ve come to the conclusion that it really is the quantity of data that is the issue, not the code in my Web Service. However, chunking the data isn’t really an option at this point because it would require a complete redesign of my entire project. We just did it to test scenarios. My problem is that I can’t figure out what is closing my connection and/or why.

On the server side, my web.config has
<httpRuntime executionTimeout="39600" maxRequestLength="1048576"/>
Which should allow it to run for 11 hours and up to a gig of data.
I also have this:
<requestLimits maxAllowedContentLength="4294967295"/>

Which allows over 4 gig of data.

Here is my code on the client side to call the web service method:
Dim ws As New MyWebServiceNameRef.MyWebService
ws.Url = SetWsUrl(ws.Url, gblstrWebServiceUrl)
'Timeout is in milliseconds, so this is 2,147,483 seconds or 35,791 minutes or 596 hours or almost 25 days
ws.Timeout = 2147483647
Dim ds As DataSet = ws.DownloadData(parm1, parm2, parm3)
ws = Nothing

We've also put my web service into a different Application Pool that is setup with less restrictive time and data limits on when it recycles.

Does anyone know of some other kind of timeout or max data limit that could be the problem? I’m drawing a complete blank as to what to even try next to fix this.

Yeah, I'm being a rebel and just trying to bump this question back up so it gets more attention. Still have no idea how to fix this issue and would appreciate any ideas. Thanks.
Updated 20-Aug-15 3:41am

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