Monday, November 23, 2009

Soap Client Timeout WebServices

Ok so I created this blog post so that when someone else searches the internet for this problem they can find my simple solution. I hate it when I search on google for over 20 mins trying to find some simple solution. I Hope this helps someone.

I have a web service which is taking in a tab delimited data file and put it into a SQL database. But I had problems, my web browser kept timing out before the processing was done. Oddly enough the web service finishes the task anyway, but I have a user issue with them getting an error message.

So the fist thing I did was I used AJAX to place a message on the screen that the file was being processed and I set the AysncPostbackTimeout in the Script Manger to 0 so it would never time out. But this only solved one problem, the bowser stopped displaying an error message, but the underlining call was still dieing, and so I could not update the web site once it was done.

To fix that I updated the InnerChannel.OperationTimeout to an hour by doing so:
(Web Service Soap Client).InnerChannel.OperationTimeout = New System.TimeSpan(1, 0, 0)

This makes it wait an hour before it gives a timeout error (more then enough time)

I should change all the values to 5 mins as that now if there really is an error It will make the user wait an hour.

No comments:

Post a Comment