开发者

Raise the time-out for a single webservice

开发者 https://www.devze.com 2022-12-25 03:18 出处:网络
My web configuration looks as follows: <system.web> <compilation debug=\"false\"/> <httpRuntime executionTimeout=\"90\"/>

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 mi开发者_StackOverflow中文版nutes

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


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.


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.


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消