How to Call a Service Method Asynchronously using WCF
Most methods in
Windows Communication Foundation (WCF) services may be called either
synchronously or asynchronously. Calling a method asynchronously enables your
application to continue to work while the method is being called when it
operates over a slow connection.
By default, when a
service reference is added to a project it is configured to call methods
synchronously. You can change the behavior to call methods asynchronously by
changing a setting in the Configure Service Reference dialog
box.
|
Note
|
|
This option is set on a per-service basis.
If one method for a service is called asynchronously, all methods must be
called asynchronously.
|
|
Note
|
|
Your computer might show different names or
locations for some of the Visual Studio user interface elements in the
following instructions. The Visual Studio edition that you have and the
settings that you use determine these elements.
|
To call a service method asynchronously
- In Solution Explorer, select the service
reference.
- On the Project menu, click Configure
Service Reference.
- In the Configure Service Reference dialog
box, select the Generate asynchronous operations check
box.
No comments:
Post a Comment