如何在ASP .NET中增加任务的默认运行时间? [英] How can I increase the default run time of task in ASP .NET ?

查看:95
本文介绍了如何在ASP .NET中增加任务的默认运行时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用Async Task,我想增加异步任务的时间,以便在超时之前完成任务,任何人都知道如何增加默认时间的值?



我尝试过:



i希望通过使用YouTube Data API上传视频我已经自定义了视频的最大上传大小和进程的执行运行时间,但是当我上传大小超过10 MB的视频时,它显示出特定任务的时间错误,任何正文都可以告诉我如何最大化Async的值任务?

i am using Async Task in my application and i want to increase the time of async task so that the the task can be completed before time out can anybody know how can i increase the value of default time out ?

What I have tried:

i want to upload the video's by Using YouTube Data API and i already customize the max upload size of video and execution run time of process but when i upload the video having size more then 10 MB that it shows error of time out of specific task can any body tells how i can maximize the value of Async Task ?

推荐答案

异步操作的默认超时为45秒。要覆盖它,请添加 AsyncTimeout属性 [ ^ ]到你的行动:

The default timeout for async actions is 45 seconds. To override that, add the AsyncTimeout attribute[^] to your action:
[AsyncTimeout(60000)]
public async Task<ActionResult> YourAction()
{
   ...
}



如果你希望你的行动永不超时,你可以使用< a href =https://msdn.microsoft.com/en-us/library/system.web.mvc.noasynctimeoutattribute%28v=vs.118%29.aspx> NoAsyncTimeout属性 [ ^ ],或者将 -1 传递给 AsyncTimeout 构造函数。


If you want your action to never time out, you can use the NoAsyncTimeout attribute[^], or pass -1 to the AsyncTimeout constructor.


这篇关于如何在ASP .NET中增加任务的默认运行时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆