Carra
Carra

Reputation: 17964

Raise the time-out for a single webservice

My web configuration looks as follows:

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

This is fine for most webservice functions but one function has a query that is running a very long (5 minutes) time and will be stopped before it has finished. Is it possible to set the runtime to 5 minutes for this webservice alone?

E.g.:

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

I've thought about running the database query async (fire and forget) but it doesn't seem possible with sybase/oracle through ODBC.

Upvotes: 4

Views: 2182

Answers (3)

Richard
Richard

Reputation: 1252

Yes, you can do that. In the web.config, you'll need to add a <location/> element:

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

The <location/> element gives you a mechanism whereby you can apply web.config attributes to specific paths within your site.

Upvotes: 12

cjk
cjk

Reputation: 46475

You can use a delegate within your webservice to call another method asynchronously. Within this method you can do your database IO. This means you will return to the caller before the operation is complete, however if you generate a unique ID and store any info related to that ID, then you can retrieve it at a later date.

Upvotes: 2

Kamran Khan
Kamran Khan

Reputation: 9986

Did you check the .Timeout property of web service?

Indicates the time an XML Web service client waits for a synchronous XML Web service request to complete (in milliseconds).

Upvotes: -1

Related Questions