Increase timeout for one web service

My web configuration is as follows:

<system.web> <compilation debug="false"/> <httpRuntime executionTimeout="90"/> </system.web> 

This works great for most webservice functions, but one function has a request that runs for a very long time (5 minutes) and will be stopped before it finishes. Is it possible to set a runtime of 5 minutes for this web service?

For instance:

  MyWebServices.asmx?op=WS_LongMethod --> Timeout of 5 minutes 

I was thinking of starting an async (fire and forget) database query, but this is not possible using sybase / oracle via ODBC.

+4
source share
3 answers

Yes you can do it. In web.config you need to add the <location/> element:

 <location path="Path_To_Your_Service.asmx"> <system.web> <httpRuntime executionTimeout="90"/> </system.web> </location> 

The <location/> element provides you with a mechanism for applying web.config attributes to specific paths on your site.

+10
source

You can use the delegate in your web service to asynchronously call another method. As part of this method, you can make your IO database. This means that you will return to the caller before the operation is completed, however, if you create a unique identifier and save the information associated with this identifier, you can get it later.

+2
source

Have you checked the .Timeout property of the web service property?

Indicates the time during which the XML web service client waits for the synchronous request of the XML web service to complete (in milliseconds).

-1
source

Source: https://habr.com/ru/post/1305433/


All Articles