长时间运行的任务 - 最佳实践 - ASP.NET 4.0,C# [英] Long Running Tasks - Best Practice - ASP.NET 4.0, C#
问题描述
什么是推荐的方式来处理的过程,需要很长的时间来执行?我不想简单地在服务器上运行它,因为页面会超时。
What is the recommended approach to dealing with process which take a long time to execute? I don't want to simply run it on the server since the page will time out.
我浏览网页,发现多种方法 - AJAX,线程,网络服务(其中没有我有经验)
I browsed the web and found multiple approaches - AJAX, Threading, Web Services... (none of which I have experience with)
什么是处理这个问题的最佳实践方法是什么?
What is the best practice method of dealing with this?
感谢你。
推荐答案
一个透明和可靠的方法是同时处理队列中的WebService实现所需的任务。因此,在客户端,你可以简单地发送请求给Web服务器,获得一定的ID作为回报,以便在以后检查结果。
One transparent and reliable way is to implement desired task along with processing queue as WebService. Thus, on client-side you can simply send request to webserver, receive some id in return in order to check the result later.
其他一切都取决于你正在想如何丰富的用户体验来实现。你可以简单地让用户通过pressing按钮不时刷新控制或整个页面的时间。或实现基于ajax控制发送请求,并检查是否不时结果本身。
Everything else depends on how rich user-experience you are trying to implement. You can simply let user to refresh control or entire page from time to time by pressing a button. Or implement ajax-based control that sends requests and checks for the results from time to time by itself.
这篇关于长时间运行的任务 - 最佳实践 - ASP.NET 4.0,C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!