等待异步Web服务完成。 [英] Waiting for async webservices to finish.

查看:82
本文介绍了等待异步Web服务完成。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在循环浏览一个文本文件,每行都会启动一个Web服务,

异步。


在我继续进行下一步之前,我想确保

所有的网络服务都已完成。


我怎么能这样做?


如果我只是用一个任意数字(比如5

分钟)放一个Thread.Sleep就可以了asynch web服务继续处理?或者他们会在主线程休眠时冻结



-

Texeme Textcasting Technology
http://www.texeme.com

解决方案




如果异步调用Web服务,每个异步都应该有一个引用

代表。因此,您可以在每个代理上调用EndInvoke

等待异步过程完成。虽然调用线程将在等待期间被冻结,但这不会阻止Web服务完成其任务。


-

此致,

Dmytro Lapshyn [Visual Developer - Visual C#MVP]

< ja ***** @ texeme。 COM>在消息中写道

news:fP ******************** @ speakeasy.net ...



我循环浏览一个文本文件,并且每行都会异步启动一个web
服务。

在我继续之前在这个过程的下一步,我想确保所有的Web服务都已完成。

我该怎么做?

如果我只是把一个Thread.Sleep带一些任意数字(比如5
分钟)asynch web服务会继续处理吗?或者当主线睡觉时它们会被冻结吗?


-
Texeme Textcasting Technology
http://www.texeme.com




您好,


如果您异步调用Web服务,则每个异步委托都应该有一个引用

。因此,您可以在每个代理上调用EndInvoke

等待异步过程完成。虽然调用线程将在等待期间被冻结,但这不会阻止Web服务完成其任务。


-

此致,

Dmytro Lapshyn [Visual Developer - Visual C#MVP]

< ja ***** @ texeme。 COM>在消息中写道

news:fP ******************** @ speakeasy.net ...



我循环浏览一个文本文件,并且每行都会异步启动一个web
服务。

在我继续之前在这个过程的下一步,我想确保所有的Web服务都已完成。

我该怎么做?

如果我只是把一个Thread.Sleep带一些任意数字(比如5
分钟)asynch web服务会继续处理吗?或者当主线睡觉时它们会被冻结吗?


-
Texeme Textcasting Technology
http://www.texeme.com




" JA ***** @ texeme.com" < JA ***** @ texeme.com>写在

新闻:fP ******************** @ speakeasy.net:

如果我是只需将一个Thread.Sleep与一些任意数字(比如
5分钟)放在一起,asynch Web服务会继续处理吗?或者
它们会在主线程休眠时被冻结吗?




它们将继续处理。

-

Chad Z. Hower(又名Kudzu) - http://www.hower .org / Kudzu /

编程是一种反击的艺术形式


使你的ASP.NET应用程序运行得更快
http://www.atozed.com/IntraWeb/




I am looping through a text file, and with each row, I launch a web service,
asynchronously.

Before I move on to the next step in the process, I want to make sure that
all the web services have completed.

How can I do this?

If I were to just put a Thread.Sleep with some arbitrary number ( say 5
minutes ) would the asynch web services continue to process? Or would they
be frozen while the main thread sleeps?


--
Texeme Textcasting Technology
http://www.texeme.com

解决方案

Hi,

If you invoke the Web services asynchronously, you should have a reference
to each async delegate. Therefore, you can call EndInvoke on each delegate
to wait while the async process finishes. While the calling thread will be
frozen during the waiting, this will not prevent the Web service from
completing its task.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
<ja*****@texeme.com> wrote in message
news:fP********************@speakeasy.net...



I am looping through a text file, and with each row, I launch a web
service,
asynchronously.

Before I move on to the next step in the process, I want to make sure that
all the web services have completed.

How can I do this?

If I were to just put a Thread.Sleep with some arbitrary number ( say 5
minutes ) would the asynch web services continue to process? Or would
they
be frozen while the main thread sleeps?


--
Texeme Textcasting Technology
http://www.texeme.com




Hi,

If you invoke the Web services asynchronously, you should have a reference
to each async delegate. Therefore, you can call EndInvoke on each delegate
to wait while the async process finishes. While the calling thread will be
frozen during the waiting, this will not prevent the Web service from
completing its task.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
<ja*****@texeme.com> wrote in message
news:fP********************@speakeasy.net...



I am looping through a text file, and with each row, I launch a web
service,
asynchronously.

Before I move on to the next step in the process, I want to make sure that
all the web services have completed.

How can I do this?

If I were to just put a Thread.Sleep with some arbitrary number ( say 5
minutes ) would the asynch web services continue to process? Or would
they
be frozen while the main thread sleeps?


--
Texeme Textcasting Technology
http://www.texeme.com




"ja*****@texeme.com" <ja*****@texeme.com> wrote in
news:fP********************@speakeasy.net:

If I were to just put a Thread.Sleep with some arbitrary number ( say
5 minutes ) would the asynch web services continue to process? Or
would they be frozen while the main thread sleeps?



They will continue to process.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/


这篇关于等待异步Web服务完成。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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