为什么要等待异步Web服务调用 [英] Why Wait for Asynchronous Web Services Calls
问题描述
我在WebServices的经历MSDN文档。 这里和的此处,这两个环节谈调用Web服务并等待回应,这也是我所见过的同时异步执行大势所趋。
I was going through MSDN documentation on WebServices. Here and here, both these links talk about calling a webservice and wait for the response, which is also a general trend that I have seen while asynch implementation.
我不明白,为什么我们还需要等待服务调用返回?而且,如果大家都在等待,为什么不做一个同步调用。一个异步调用其次是等待和同步调用之间的区别是什么?
I don't understand "why do we need to wait for service call to return"? And, if we are waiting why don't make an synchronous call. What is the difference between an "asynch call followed by wait" and a "synchronous call"?
推荐答案
天生我才必有用,异步调用需要,而你去做点别的事情做的事情。有两种方法可以做到这一点:
To be useful, the asynchronous call needs to do its thing while you go do something else. There are two ways to do that:
您不会使用WaitHandle的做这两件事情。然而,WaitHandle的类可以使客户端进行异步调用,并等待:
You wouldn't use a WaitHandle to do these two things. However, the WaitHandle class makes it possible for clients to make an asynchronous call and wait for:
- 在一个XML Web服务
(
WaitHandle.WaitOne
), - 第一的许多XML Web服务
(
WaitHandle.WaitAny
),或 - 在所有的许多XML Web服务
(
WaitHandle.WaitAll的
)
- a single XML Web service
(
WaitHandle.WaitOne
), - the first of many XML Web services
(
WaitHandle.WaitAny
), or - all of many XML Web services
(
WaitHandle.WaitAll
)
返回结果。
在换句话说,如果你使用的WaitOne
或了WaitAny
在返回几个结果异步Web服务,可以从您的Web服务调用获得一个结果,和的处理它,而你正在等待其余结果的。
In other words, if you use WaitOne
or WaitAny
on an asynchronous web service that returns several results, you can obtain a single result from your web service call, and process it while you are waiting on the remaining results.
这篇关于为什么要等待异步Web服务调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!