Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


WCF Asynchrous call in C#

Posted on 2011-10-19
Medium Priority
Last Modified: 2012-05-12
Hi Experts,

 What is differerenece between calling WCF service synchronously and calling with AsyncWaitHandle.WaitOne() method?

Whether AsyncWaitHandle.WaitOne()  boost the performance?

I've WCF service. Is it good to call the service with AsyncWaitHandle.WaitOne() or any other asynchronous method in all layers such as Business object method of the service and Data access method of it?

I tested with time difference in millisecond before calling the service and after calling the servie but it shows different result in each time. I could not come to conlusion.

Please guide me.
Question by:Easwaran Paramasivam
  • 2
  • 2
LVL 41

Expert Comment

by:Kyle Abrahams
ID: 37002452
Synchronous - Code will wait for response to come back - your UI will freeze until the response is processed

Asynchronous - Call is made and awaits an answer on the call back function.  Other operations can be performed and UI will not freeze.

The reason you're not observing a noticeable difference (and getting different results) is that it's very dependant on what is going on within the computer itself (assuming everything is local) or on the network / server (if you're actually talking to servers).  

Add a time delay to your service (EG: thread.Sleep(7000) ) to notice the difference in the calls and simulate a larger list / latency.
LVL 16

Author Comment

by:Easwaran Paramasivam
ID: 37004596
Thanks for your comments. But I would like to get answer for the questiong I mentioned above. Could you please give more points?
LVL 41

Accepted Solution

Kyle Abrahams earned 1000 total points
ID: 37006535
LVL 16

Author Closing Comment

by:Easwaran Paramasivam
ID: 37158031

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Screencast - Getting to Know the Pipeline
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question