Web Service call fails after long time


S

Selden

I have a web service that copies and archives a database. Depending on the
size, it takes anywhere from 1 minute to 8 minutes to complete.

So I call the method asynchronously, and have a callback.

If the archive takes 4 minutes, it DOES call the callback routine, but
throws an error when the callback is called.

Here's the gist of the code on the calling side: (WFS is the web service
proxy generated by WSDL)
Dim callback As New AsyncCallback(AddressOf FinishArchiveWeb)
Dim ar As IAsyncResult
Dim sResults as String
WFS.BeginArchiveShoot(<some params>, sResults, callback, ar)


Here's the callback:

Private Sub FinishArchiveWeb(ByVal ar As IAsyncResult)
Dim sResults As String
Try
WFS.EndArchiveShoot(ar, sResults)
<some processing goes here>

Catch ex As Exception
<examine the exception here>
End Try
End Sub

If the call takes 4 minutes or longer, the callback throws an exception:
"The underlying connection was closed: An unexpected error occurred on a
receive."

But if the archive takes 2 minutes or less, it succeeds without any error.

I've tried increasing the .Timeout property of the proxy, but that didn't
seem to make any difference.

Any ideas or suggestions?
Thanks,
---Selden McCabe
 
Ad

Advertisements

T

Techno_Dex

Try adding logging into your web service to see what is occuring and what
error is being thrown. The error sounds like IIS (or whatever is hosting
your service) might be terminating your session. In this case I'm not sure
right off how to prevent this, you might check in IIS for timeout settings.

Things to try:
Trying setting the Timeout the -1 (Infinite) to see if it will run.
(Although this shouldn't matter if you are making Asynch calls)
Try setting Connection Timeouts and Command Timeout on Database connections
if you are using them to dump/archive your DB
Try catching a WebException and looking at the stack trace to see where the
exception is being thrown.
 
Ad

Advertisements

S

Selden

Thanks for these suggestions, I'll try them. If I discover the fix, I'll
post it here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top