开发者

ASP.net MVC Execute asynchronously

Is t开发者_JS百科here a way to make a controller return something to the user first then execute another method?

I have a process that is very time consuming. I'd like to send back a quick JSON response to the user then process.


In that scenario, you might want to consider doing the ongoing task on a worker thread. The MVC loop must complete in order to return the response to the caller. Note that background threads will not have access to the request context, so you must capture anything you need. Note also that you cannot return anything to the caller once the http context has exited - you will need the caller to call back to get any extra data.


This may serve as a good example: http://tpeczek.com/2010/07/reporting-server-side-operation.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜