简体   繁体   English

阻塞线程直到 WCF 回调被引发?

[英]Block thread until WCF callback is raised?

Is it possible to wait on a callback in WCF?是否可以在 WCF 中等待回调? Giventhis article, I will raise a callback in my WCF service, but I want the client (a seperate application) to only proceed (ie go to the next line of code, eg close a form etc, after the callback is raised. So I need to block until the callback is raised.鉴于本文,我将在我的 WCF 服务中引发回调,但我希望客户端(单独的应用程序)在引发回调后仅继续(即 go 到下一行代码,例如关闭表单等)。所以我需要阻止直到回调被引发。

How could I do this?我怎么能这样做?

Instead of using callbacks, you could call the service synchronously from the client.您可以从客户端同步调用服务,而不是使用回调。

If the client does not require any data to be returned, you could return a void, and the client will still wait for the call to complete.如果客户端不需要返回任何数据,您可以返回一个 void,客户端仍将等待调用完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM