用于执行长时间运行任务的Web应用程序/服务 [英] Web Application/Service for executing long running tasks

查看:93
本文介绍了用于执行长时间运行任务的Web应用程序/服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能指出我的代码示例,说明从ASP.NET中的Web应用程序执行长期运行任务(异步)吗?我认为Web服务可能会在某些时候发挥作用,但是我不确定

是如何开始的。


例如,我有一个应用程序,当用户通过

按钮或链接点击启动时,会出去生成一堆文件(这可能是

需要几分钟)。这将分批进行,所以我想让web应用程序开始生成所有工作,然后在每个工作完成后收到

a通知,我可以更新页面。

但是,很明显,我不希望Web应用程序本身在所有

这个处理过程中被捆绑。在.NET中构建这个的最佳方法是什么?希望

之前有人做过这个,可以给我一些入门代码

样品......


谢谢,

BK

Can someone point me to a code sample that illustrates executing long
running tasks (asynchronous) from a web application in ASP.NET? I assume
that Web Services might come into play at some point, but I''m not sure how
to get started.

For example, I have an application that, upon a user initiating through a
button or link click, will go out and generate a bunch of files (this could
take several minutes). This will happen in batches, so I would like to have
the web application kick off the generation of all the jobs and then receive
a notification as each job finishes, at which point I could update the page.
But, obviously, I don''t want the web application itself tied up during all
this processing. What is the best way to architect this in .NET? Hopefully
someone has done this before and can point me to some starter code
samples...

Thanks,
BK

推荐答案

HI BK,


据我所知,可以你无法使用真正的网络应用程序从服务器端控制

客户端上的操作。


当然,您可以从客户端开始批量生产

通过实例重复使用说明我给你的样品如下。

使用它你可以在每次更新页面时显示。


但是在我看来不是同步的。因此,服务器需要访问客户端上的



请记住,客户端无论出于何种原因都可以断开连接。


\\\

Dim scriptString As String ="< script language = JavaScript>" &安培; _

" setclock(); function setclock(){document.images.Image1.src =" &安培; _


"''http://mysite/WebForm1.aspx''; setTimeout(''setclock()'',1000)}< / script>"

Page.RegisterStartupScript(" setclock",scriptString)

///


当你想要做的时候有趣的页面正常的东西

解决方案

http://msdn.microsoft.com/security/d...p2websites.asp

我希望这对此有帮助吗?


Cor
HI BK,

As far as I know, can you not control from the serverside the actions on the
clientside using a real webapplication.

You can of course start your batches from the clientside wherefore you can
use by instance repeated instructions in a way I give you the sample bellow.
Using that you can show every time an updated page.

However in my opinion not assynchronous. Therefore the server needs access
on the client.

Keep always in mind that your client can disconnect for whatever reason.

\\\
Dim scriptString As String = "<script language=JavaScript>" & _
"setclock(); function setclock(){document.images.Image1.src = " & _

"''http://mysite/WebForm1.aspx'';setTimeout(''setclock()'',1000)}</script>"
Page.RegisterStartupScript("setclock", scriptString)
///

An intresting page when you are thinking to do something beside the normal
solutions

http://msdn.microsoft.com/security/d...p2websites.asp

I hope this helps anyway?

Cor
有人能指出我的代码示例,说明执行长
例如,我有一个应用程序,当用户通过
按钮或链接点击启动时,将出去生成一堆文件(这个
可能需要几分钟)。这将分批进行,所以我想
让Web应用程序启动所有作业的生成,然后
在每个作业完成时收到通知,此时我可以更新
页面。但是,显然,我不希望Web应用程序本身在所有这些处理过程中都被束缚住了。在.NET中构建这个的最佳方法是什么?希望有人之前已经做过这个并且可以给我指点一些入门代码
样品......

谢谢,
BK
Can someone point me to a code sample that illustrates executing long
running tasks (asynchronous) from a web application in ASP.NET? I assume
that Web Services might come into play at some point, but I''m not sure how
to get started.

For example, I have an application that, upon a user initiating through a
button or link click, will go out and generate a bunch of files (this could take several minutes). This will happen in batches, so I would like to have the web application kick off the generation of all the jobs and then receive a notification as each job finishes, at which point I could update the page. But, obviously, I don''t want the web application itself tied up during all
this processing. What is the best way to architect this in .NET? Hopefully
someone has done this before and can point me to some starter code
samples...

Thanks,
BK



Cor,


谢谢。不,我不打算做客户端的事情。我希望web

应用程序启动服务器端的这些任务。如你所说,客户端

可能随时断开连接,在这种情况下,我希望服务器上的任务仍然完成。在这种情况下,显然没有完成通知

,但也许下次他们联系我可以

表明他们的工作状态甚至发送电子邮件。对于我要问的内容,这超出了范围




我正试图弄清楚如何在.NET中执行可能

来自Web应用程序的长时间运行的任务,并且仍允许用户在完成其他任务时执行




Cor Ligthert <无********** @ planet.nl>在消息中写道

新闻:#L ************* @ tk2msftngp13.phx.gbl ...
Cor,

Thanks. No, I am not looking to do things client side. I want the web
application to kick off these tasks server-side. As you mention, the client
could disconnect at any time, and in that case I would like the tasks to
still complete on the server. There would be no notification of completion
in that case, obviously, but perhaps next time they connected I could
indicate the status of their jobs or even send email. That is out of scope
for what I''m asking though.

I just am trying to figure out how, in .NET, I would execute potentially
long-running tasks from a web application and still allow the user to do
other things while they finish.

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:#L*************@tk2msftngp13.phx.gbl...
HI BK,

据我所知,您是否可以使用真实的Web应用程序从服务器端控制客户端上的
上的操作。

您当然可以从因此,您可以通过实例重复说明使用我给您样品
贝洛。使用它你可以在每次更新页面时显示。

但是在我看来不是同步的。因此服务器需要访问客户端。

请记住,客户端无论出于何种原因都可以断开连接。

\\\ Dim scriptString As String ="< script language = JavaScript>" &安培; _
" setclock(); function setclock(){document.images.Image1.src =" &安培;
_
"''http://mysite/WebForm1.aspx''; setTimeout(''setclock()'',1000)}< / script>"
页面.RegisterStartupScript(" setclock",scriptString)
///

当你想要做一些正常的解决方案时,有趣的页面
http:// msdn.microsoft.com/security/d...en-us/dnwxp/ht

ml / xpsp2websites.asp
我希望这对此有帮助吗?

Cor
HI BK,

As far as I know, can you not control from the serverside the actions on the clientside using a real webapplication.

You can of course start your batches from the clientside wherefore you can
use by instance repeated instructions in a way I give you the sample bellow. Using that you can show every time an updated page.

However in my opinion not assynchronous. Therefore the server needs access
on the client.

Keep always in mind that your client can disconnect for whatever reason.

\\\
Dim scriptString As String = "<script language=JavaScript>" & _
"setclock(); function setclock(){document.images.Image1.src = " & _
"''http://mysite/WebForm1.aspx'';setTimeout(''setclock()'',1000)}</script>"
Page.RegisterStartupScript("setclock", scriptString)
///

An intresting page when you are thinking to do something beside the normal
solutions

http://msdn.microsoft.com/security/d...en-us/dnwxp/ht
ml/xpsp2websites.asp
I hope this helps anyway?

Cor
有人能指出我的代码示例,说明从ASP.NET中的Web应用程序执行长期运行任务(异步)吗?我认为Web服务可能会在某些时候发挥作用,但我不确定
如何开始。

例如,我有一个应用程序,当用户通过
a按钮或链接点击启动时,将出去生成一堆文件(此
Can someone point me to a code sample that illustrates executing long
running tasks (asynchronous) from a web application in ASP.NET? I assume
that Web Services might come into play at some point, but I''m not sure how to get started.

For example, I have an application that, upon a user initiating through a button or link click, will go out and generate a bunch of files (this


可以

需要几分钟)。这将分批进行,所以我想
take several minutes). This will happen in batches, so I would like to


web应用程序启动所有作业的生成然后
the web application kick off the generation of all the jobs and then


收到

每个作业完成后的通知,此时我可以更新
a notification as each job finishes, at which point I could update the


页面。

但是,显然,我不想要所有这些处理过程中,Web应用程序本身都在
期间。在.NET中构建这个的最佳方法是什么?
希望以前有人这样做过,可以给我指点一些入门代码
样品......

谢谢,
BK
But, obviously, I don''t want the web application itself tied up during all this processing. What is the best way to architect this in .NET? Hopefully someone has done this before and can point me to some starter code
samples...

Thanks,
BK




嗨BK,


这在我看来不是问题。
Hi BK,

This would in my opinion not a problem.
谢谢。不,我不打算做客户端的事情。我希望web
应用程序能够在服务器端启动这些任务。正如您所提到的,
客户端可能随时断开连接,在这种情况下,我希望服务器上的任务仍然完成。显然,在这种情况下,没有完成通知
,但也许下次他们联系我可以指示他们的工作状态,甚至发送电子邮件。对于我要问的内容,这超出了范围。
Thanks. No, I am not looking to do things client side. I want the web
application to kick off these tasks server-side. As you mention, the client could disconnect at any time, and in that case I would like the tasks to
still complete on the server. There would be no notification of completion
in that case, obviously, but perhaps next time they connected I could
indicate the status of their jobs or even send email. That is out of scope
for what I''m asking though.




您可以跟踪您在数据库中的位置。


然而,当用户忙于网页时,他可以永远地做其他事情。

重点是他必须在会话结束前做出反应。 (并且你能够以适当的方式回归来获得
。)


只是我的想法,


Cor




You can keep track of where you are in a database.

However when a user is busy with a webpage he can forever do otherthings.
The point is that he has to react before the session ends. (And you catch it
in a way that he comes back at the proper point.)

Just my thoughts,

Cor



这篇关于用于执行长时间运行任务的Web应用程序/服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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