在ASP.NET长时间运行的进程处理 [英] Dealing with Long running processes in ASP.NET

查看:183
本文介绍了在ASP.NET长时间运行的进程处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道对付长时间运行的进程的最佳方式开始从ASP.NET网页的需求。

I would like to know the best way to deal with long running processes started on demand from an ASP.NET webpage.

这个过程可能包括的各个步骤(如文件上传到服务器,在上面运行SSIS包,执行一些存储过程等),有时这个过程可能需要长达几个小时才能完成。

The process may consist of various steps (like upload files to the server, run SSIS packages on them, execute some stored procedures etc.) and sometimes the process could take up to couple of hours to finish.

如果我使用WCF服务去异步执行,那么如果用户关闭而进程正在运行,过程如何成功或失败的结果应显示给用户的浏览器中会发生什么?为了解决这个问题,我选择单向WCF服务电话,但这个问题是我需要创建一个进程表,并将结果(和错误消息,如果在任何一个步骤失败和步骤已成功完成)的该表,它是一个额外的开销,因为存在与各种步骤的许多这样的方法,用户可以从该网页调用和用户需要被告知的进度(在简单的情况下,该状态可以是处理的xyz运行)并且一旦完成,输出需要被显示给用户(例如,通过运行一个存储过程)。

If I go for asynchronous execution using a WCF service, then what happens if the user closes the browser while the process is running, how the process success or failure result should be displayed to the user? To solve this, I choose one-way WCF service calls, but the problem with this is I need to create a process table and store the result (and error messages if it fails in any of the steps and which steps have completed successfully) in that table which is an additional overhead because there are many such processes with various steps that the user can invoke from the web page and user needs to be made aware of the progress (in simplest case, the status can be "process xyz running") and once it is done, the output needs to be displayed to the user (for example by running a stored procedure).

什么是设计这个解决方案的最佳方式?

What is the best way to design the solution for this?

推荐答案

在我看来,你有三种选择

As I see it, you have three options


  1. 拥有了用户等待响应长时间运行的页面。如果这是几个小时,你将有很多可用性问题,所以我甚至不会考虑它。

  2. 创建一个进程表来存储操作的结果。运行服务功能和异步日志委派的结果,该服务。可以存在用户刷新它获取该表的最新结果的页面。

  3. 如果你真的不想要创建一个表,然后存储在所有用户的会话状态的当前进程的详细信息,并有当前流程页面如上。你有可能的问题,本次会议可能会超时,或Web应用程序可能会重新启动,你会失去这一切。

我看不到这个数字2是这样一个伟大的困难。你可以使表非常通用涵盖所有类型的进程:工艺细节可能只是带codeD二进制或xml和间由Web应用程序PTED $ P $。那么你拥有的最强大的解决方案。

I can't see that number 2 is such a great hardship. You could make the table fairly generic to encompass all types of processes: process details could just be encoded as binary or xml and interpreted by the web application. You then have the most robust solution.

这篇关于在ASP.NET长时间运行的进程处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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