简体   繁体   中英

How do you make a WCF Client asynchronous?

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?

ps 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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