What Happens When WebClientProtocol Timeouts
We have a client application that has a link to a web service. We set the timeout property on the webclientprotocol object to 50 (ms) and wanted to watch what was happening. We've linked a long web method that returns a huge DataSet to the client. When the default was there, the DataSet was correctly returned to the client. When we changed this to 50 (ms), we didn't notice anything. We assumed that from the moment the timeout expires, there will be some kind of exception that happens on the client side. Can someone please explain what is going on here.
Thanks Raj
Unfortunately the documentation is unclear. When you say that you "observed nothing," what exactly do you mean? Was the code forever eternal? Was there an exception? Presumaby has not returned a valid DataSet.
I would have expected there to be a TimeoutException , but I'm surprised it's not entirely obvious in your client code. You don't swallow exceptions, do you?
Is the call being executed synchronously or asynchronously? If it is asynchronous, I expect the callback to be executed and then an exception to be thrown to call "EndXxx".
I highly recommend writing a short console application that simply calls a web service to see what happens.
source to share
I just ran into this. In .NET 2.0 webservice, it highlights a rather non-specific WebException
, just for a property Message
to differentiate it:
The request was aborted: The connection was closed unexpectedly.
I haven't tried it in the default WCF service references generated in newer versions of Visual Studio, but if I understand this correctly, they throw in a more useful one TimeoutException
, which, like Jon Skeet , I would guess (and would rather) be the behavior in the web service.
Note that the timeout is only for synchronous calls (at least in a web service, I think this is also true for a WCF service reference). If you need to call the timeout asynchronously, you will have to set the timer and cancel the call manually, like demonstrate here .
source to share