timeout for asynchronous web service call in C#

14,827

In the web.config for your webservice you can set a timeout (You will also need to change to not be in debug mode if it is). This should then cause it to throw an exception that will raise your completed event. You will then need to inspect for an exception to see if it passed or failed.

<system.web>
    <httpRuntime executionTimeout="120" />
</system.web>
Share:
14,827
George2
Author by

George2

Updated on June 27, 2022

Comments

  • George2
    George2 almost 2 years

    I am using C# and created a proxy from a ASP.Net asmx Web Service at client side, by using Add Web Reference... feature of VSTS 2008.

    And I am using the asynchronous method call model (i.e. call the AsyncXXX method, which will return immediately) and handles the complete event (I add event handler to handle the complete even when the reponse is received from server side).

    I find if there is no response from server for a long time, the complete event will not be fired.

    My questions are,

    1. Is it expected feature or my bug that if no response from server after call AsyncXXX method, complete event handler will not be called?

    2. Are there any way to assign timeout value -- so that I do not wait on the complete event handler infinitely?

    thanks in advance, George