开发者

WebService timeout

开发者 https://www.devze.com 2023-02-12 12:19 出处:网络
I deployed one webservice which calls function which going take more than 5 -6 hours. I am using this webservice on my asp.net page and I am calling this webservice asynchronously. So how should I inc

I deployed one webservice which calls function which going take more than 5 -6 hours. I am using this webservice on my asp.net page and I am calling this webservice asynchronously. So how should I increase webservice t开发者_开发技巧ime out?


If you are calling a function that takes 5-6 hours to complete, you may want to re-think your architecture. Would a user sit on the page and wait 5 or 6 hours for your process to finish? Probably not. Maybe you could have your web service set an indicator in a database, xml file or some other data store when it has completed. Then, in your asp.net page, you can click a button or complete some other action to check that indicator to see if the process has finished.


You need to chance the executionTimout in your Web.Config to something large like :

executionTimeout unit is in seconds.

<configuration>
    <system.web>
        <httpRuntime executionTimeout="21600"/>
    </system.web>
</configuration>


If you are ok with all requests in your webservice having a long timeout, you can set

<httpRuntime executionTimeout="300"/>

Under

<system.web>

in your web.config, where 300 is your timeout in seconds

However, as DevSlick answers, you may want to reconsider your archetecture, web services aren't meant for long running tasks, you may want to create a console application that runs on a schedule.

0

精彩评论

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