asp.net中的后台进程 [英] Background process in asp.net

查看:80
本文介绍了asp.net中的后台进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友


我需要使用Magento API将所有产品从本地数据库导入到Magento网站.我已经在我们的系统中实现了此功能.

我有以下要求.

1.当我点击提交按钮时,我想创建一个后台进程(线程),在该进程中执行上述操作.
2.那时该过程开始时,我将创建XML文件,以便用户可以查看操作状态.如未导入任何产品,或出现故障.
3.还希望保留中止"按钮,以便在单击中止"按钮时,进程将终止并停止执行剩余的进程.
4.处理完成后,再次写下XML文件以显示处理已完成.

我当时以为可以通过使用"ThreadPool.QueueUserWorkItem"来实现此目标,但是我无法确定要中止该进程.

谁能告诉我完成任务需要使用哪些功能?

谢谢
Imrankhan

Hi friends


I need to import all products from local database to Magento website using Magento API. I have already implemented this feature in our system.

I have following requirement.

1. When I click on submit button then I want to create one background process(Thread) where above operation execute in that process.
2. When this process start at that time I will create XML file so user can view operation status. Such as no of products are imported, or failed.
3. Also want to keep Abort button so when Abort button is clicked then process will be terminated and stop to execute remaining process.
4. When process is completed and write down XML file again to display process has been completed.

I was thinking that I can achieve this goal by using "ThreadPool.QueueUserWorkItem" but I can not identify the process to abort it.

Can anyone tell me which features I need to use to accomplish this task?

Thanks
Imrankhan

推荐答案

我的建议是将长时间运行的任何工作单元(比平均页面请求长得多的工作单元)移到外部与ASP.net辅助进程无关的进程. ASP.net辅助进程可以被回收,这意味着长时间运行的进程将被杀死.为了控制和监视进程的状态,可以使用.NET远程处理并使进程作为Windows服务运行.

只是我的两分钱.

干杯!

--MRB
My advice to you would be to have any work units that run for a long time (anything considerably longer that an average page request) be moved to an external process that is not tied to an ASP.net worker process. The ASP.net worker processes can get recycled which would mean that your long running process would be killed. In order for you to control and monitor the status of your process you can use .NET remoting and have your process run as a windows service.

Just my two cents.

Cheers!

--MRB


这篇关于asp.net中的后台进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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