如何在长时间运行的进程执行时显示页面? [英] How to display page while long-running process executing?

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

问题描述

您好。

我们正在开发一个ASP.NET 2.0(C#)应用程序,我们正在尝试使用它来支持
AJAX。我们遇到的问题是页面没有显示页面而

正在执行长时间运行的进程。所以,我们正在寻找一种方式来显示

页面上带有请稍候......在流程运行时消息,然后

,当流程完成后,用实际结果/页面更新页面

内容。

我们有一个页面可以使用JavaScript window.open,

打开另一个浏览器/页面,在第二页的Page_Load中,我们调用长时间运行的函数。在

执行此操作时,浏览器和页面不会完全呈现任何内容,直到

长时间运行的功能完成。


那么,我们如何才能在

Page_Load中显示一个调用长时间运行进程的页面显示一个带有某种请稍等...消息的页面(并且

可能是一个函数运行时GIF动画?


新的ASP.NET AJAX中有什么东西吗?或者,还有其他一些

方式吗?


谢谢。

Hello.
We''re developing an ASP.NET 2.0 (C#) application and we''re trying to
AJAX-enable it. We''re having problem with a page not showing the page while
a long-running process is executing. So, we''re looking for a way to display
the page with a "please wait..." message while the process is running, and
then, when the process is done, update the page with the actual results/page
content.

We have a page that opens another browser/page using JavaScript window.open,
and, in the second page''s Page_Load, we call the long-running function. In
doing this, the browser and page do not completely render anything until the
long-running function is complete.

So, how can we make the page that calls the long-running process in
Page_Load display a page with some sort of please wait... message (and
probably an animated gif) while the function runs?

Is there something in the new ASP.NET AJAX stuff? Or, is there some other
way?

Thanks.

推荐答案

创建图层(DIV)并使其可见。它说请等待。最后

渲染(HTML页面底部),输出隐藏div的JavaScript。

这是基本的机制。我没有样品。 : - (


-

Gregory A. Beamer

MVP; MCP:+ I,SE,SD,DBA < br $>

***************************

在盒子外面思考!

***************************

" lmttag"写道:
Create a layer (DIV) and make it visible. It says "please wait". At the end
of the render (bottom of HTML page), output JavaScript that hides the div.
That is the basic mechanics. I do not have a sample. :-(

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"lmttag" wrote:

你好。

我们正在开发一个ASP.NET 2.0(C#)应用程序,我们正在尝试

AJAX启用它。我们遇到的问题是页面没有显示页面而

a长时间运行的进程正在执行。所以,我们正在寻找一种方法显示

在流程运行时带有请稍候...消息的页面,然后

,当流程完成后,更新页面实际结果/页

内容。


我们有一个页面可以使用JavaScript window.open打开另一个浏览器/页面,

,在第二页的Page_Load中,我们称之为长时间运行的功能。

这样做,眉毛在

长时间运行的功能完成之前,ser和page不会完全呈现任何内容。


那么,我们如何才能使页面调用long-运行过程

Page_Load在函数运行时显示一个带有某种请稍候...消息的页面(和

可能是动画gif)?


新的ASP.NET AJAX中有什么东西吗?或者,还有其他一些

方式吗?


谢谢。
Hello.
We''re developing an ASP.NET 2.0 (C#) application and we''re trying to
AJAX-enable it. We''re having problem with a page not showing the page while
a long-running process is executing. So, we''re looking for a way to display
the page with a "please wait..." message while the process is running, and
then, when the process is done, update the page with the actual results/page
content.

We have a page that opens another browser/page using JavaScript window.open,
and, in the second page''s Page_Load, we call the long-running function. In
doing this, the browser and page do not completely render anything until the
long-running function is complete.

So, how can we make the page that calls the long-running process in
Page_Load display a page with some sort of please wait... message (and
probably an animated gif) while the function runs?

Is there something in the new ASP.NET AJAX stuff? Or, is there some other
way?

Thanks.


re :

!那么,我们如何在

中创建调用长时间运行进程的页面!Page_Load显示一个带有某种请等待...消息的页面(功能运行时,可能是一个动画的GIF格式?


查看第3章中的代码示例:

< a rel =nofollowhref =http://www.daveandal.net/books/6744/samples.aspxtarget =_ blank> http://www.daveandal.net/books/6744/samples.aspx


Juan T. Llibre,asp.net MVP

asp.net faq: http://asp.net.do/faq/

foros de asp.net ,en espa?ol: http://asp.net.do/foros/

===================================

" lmttag" < lm **** @ newsgroup.nospamwrote in message news:u9 ************** @ TK2MSFTNGP04.phx.gbl ...
re:
!So, how can we make the page that calls the long-running process in
!Page_Load display a page with some sort of please wait... message (and
!probably an animated gif) while the function runs?

Check out the code samples in Chapter 3 :

http://www.daveandal.net/books/6744/samples.aspx


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espa?ol : http://asp.net.do/foros/
===================================
"lmttag" <lm****@newsgroup.nospamwrote in message news:u9**************@TK2MSFTNGP04.phx.gbl...

你好。

我们正在开发一个ASP.NET 2.0(C#)应用程序,我们正在尝试使用它来支持
AJAX。我们遇到的问题是页面没有显示页面而

正在执行长时间运行的进程。所以,我们正在寻找一种方式来显示

页面上带有请稍候......在流程运行时消息,然后

,当流程完成后,用实际结果/页面更新页面

内容。

我们有一个页面可以使用JavaScript window.open,

打开另一个浏览器/页面,在第二页的Page_Load中,我们调用长时间运行的函数。在

执行此操作时,浏览器和页面不会完全呈现任何内容,直到

长时间运行的功能完成。


那么,我们如何才能在

Page_Load中显示一个调用长时间运行进程的页面显示一个带有某种请稍等...消息的页面(并且

可能是一个函数运行时GIF动画?


新的ASP.NET AJAX中有什么东西吗?或者,还有其他一些

方式吗?


谢谢。

Hello.
We''re developing an ASP.NET 2.0 (C#) application and we''re trying to
AJAX-enable it. We''re having problem with a page not showing the page while
a long-running process is executing. So, we''re looking for a way to display
the page with a "please wait..." message while the process is running, and
then, when the process is done, update the page with the actual results/page
content.

We have a page that opens another browser/page using JavaScript window.open,
and, in the second page''s Page_Load, we call the long-running function. In
doing this, the browser and page do not completely render anything until the
long-running function is complete.

So, how can we make the page that calls the long-running process in
Page_Load display a page with some sort of please wait... message (and
probably an animated gif) while the function runs?

Is there something in the new ASP.NET AJAX stuff? Or, is there some other
way?

Thanks.



你好lmttag,


关于longrun任务的waring页面,在ASP.NET中,我们有以下方法的

所以远:


1.在某个回发事件中启动服务器端长期运行任务,然后在客户端页面中使用
,使用脚本(或html< metatag)经常回复页面以检查服务器端任务状态(使用会话

变量)。如果任务完成,请停止那些不断回发的脚本和

显示最终结果。


2.在没有ajax的时间内,我们可以选择使用一些客户端

XMLHttp post组件将http请求发送到服务器端(以轮询状态

的服务器端长期运行任务)。通过这种方式,我们可以避免不断刷新网页(如#1那样)。


这里有一些网络文章介绍了一些这样的方法:


#How To:提交和轮询长期任务
http://msdn2.microsoft.com/en-us/library/ms979200.aspx


#Building更好的等待页面
http://www.codeproject.com/ aspnet / wait_page.asp


#使用螺纹AJAX解决页面等待游​​戏
http://www.devx.com/asp/Article/29617


3.如今,我们有基于AJAX的模式,它有点像#2,

但是利用现有的ajax组件。微软AJAX框架只需提供这样一个封装良好的AJAX框架,可以帮助我们构建AJAX

Web应用程序。这里为长期运行任务,你可以在某个

回发事件中启动它,然后让客户端调用一个AJAX webservice

函数来不断轮询状态服务器端任务。


这里有关于在ASP.NET ajax应用程序中调用webservice的参考(以及

整个教程):

#从ASP.NET AJAX中的客户端脚本调用Web服务
http://ajax.asp.net/docs/tutorials/C...XTutorial.aspx

#ASP.NET AJAX路线图
http://ajax.asp.net/docs/default.aspx


希望这会有所帮助。如果您有任何更具体的问题,欢迎来到

也在这里讨论。


此致,


Steven Cheng


Microsoft MSDN在线支持主管


===================== =============================

通过电子邮件收到我的帖子通知?请参阅
http://msdn.microsoft .com / subscripti ... ult.aspx#notif

ications。


注意:MSDN托管新闻组支持服务是针对非紧急问题

如果社区或微软支持人员在1个工作日内做出初步回复是可以接受的。请注意,每个跟随

的响应可能需要大约2个工作日作为支持

专业人士与您合作可能需要进一步调查才能达到

最有效的分辨率。该产品不适用于需要紧急,实时或基于电话的交互或复杂的b $ b项目分析和转储分析问题的情况。这种性质的问题最好通过联系

Microsoft客户支持服务(CSS)处理
href =http://msdn.microsoft.com/subscriptions/support/default.aspx\"target =_ blank> http://msdn.microsoft.com/subscripti...t/default.aspx


==================================== ==============


此帖子按原样提供。没有保证,也没有授予任何权利。

Hello lmttag,

Regarding on such waring page for longrun task, in ASP.NET, we have the
following approachs so far:

1. Start the server-side long run task in a certain postback event, and
then in client-side page, use script (or html <metatag) to constantly
postback the page to check for the server-side task status(use session
variable ). If the task finished, stop those constantly postback script and
display final result.

2. During the time without ajax, we have the option to use some client-side
XMLHttp post component to send http request to server-side(to poll status
of the server-side long run task). This way, we can avoid constantly
refreshing the web page(as #1 does).

here are some web articles introduced some of such approaches:

#How To: Submit and Poll for Long-Running Tasks
http://msdn2.microsoft.com/en-us/library/ms979200.aspx

#Building a Better Wait Page
http://www.codeproject.com/aspnet/wait_page.asp

#Solve the Page Waiting Game with Threaded AJAX
http://www.devx.com/asp/Article/29617


3. Nowadays, we have the AJAX based pattern, it is somewhat like the #2,
but leverage existing ajax components. The microsoft AJAX framework just
provide such a well encapsulated AJAX framework that can help us build AJAX
web application. Here for long run task, you can start it in a certain
postback event, and then let the client-side call a AJAX webservice
function to constantly poll the status of the server-side task.

Here are reference about calling webservice in ASP.NET ajax application(and
the whole tutorial):
#Calling Web Services from Client Script in ASP.NET AJAX
http://ajax.asp.net/docs/tutorials/C...XTutorial.aspx

#ASP.NET AJAX Roadmap
http://ajax.asp.net/docs/default.aspx

Hope this helps. if you have any more specific questions, welcome to
discuss here also.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.


这篇关于如何在长时间运行的进程执行时显示页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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