你怎么做WCF客户端异步? [英] How do you make a WCF Client asynchronous?

查看:90
本文介绍了你怎么做WCF客户端异步?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有个客户发送到服务器的请求,服务器回答他

I have a client that sends a request to a server, and the server answer to him.

我想这样做,以异步方式。客户端发送的请求时,服务器计算并将其返回给客户端的服务。我怎样才能做到这一点?

I want to do this in an asynchronous way. The client sends a request, the server calculates it and returns it to a service in the client. How can i do this?

P.S。假设客户想要做加(int类型的,INT B)和服务器需要将结果发送到客户端上运行的服务。

p.s. let's say the client wants to do add(int a, int b) and the server needs to send the result to a service that run on the client.

推荐答案

一个双重绑定是唯一真正需要的时候,服务器必须给客户的发送信息,而的请求。既然你发出请求,使用更基本的绑定之一。

A dual binding is only really needed when the server must send information to the client without a request. Since you are making a request, use one of the more basic bindings.

发出请求的异步是怎么一回事时,它调用服务的客户端做什么。这样做的一个办法是让href=\"http://msdn.microsoft.com/en-us/library/ms730059.aspx\" rel=\"nofollow\">生成的客户端界面以包括基于事件的异步模式。

Making the request asynchronous is all about what the client does when it calls the service. One way of doing this is to get the generated client interface to include the event based asynchronous pattern.

当客户端调用此方法,它只是返回的时候了。被接收到的请求的实际响应时则触发事件。服务器本身与客户端如何等待响应完全无干。

When the client calls this method, it simply returns right away. An event is then triggered when the actual response to the request is received. The server itself is completely uninvolved with how the client waits for the response.

这篇关于你怎么做WCF客户端异步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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