WCF Asynchrous call in C#

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.
LVL 16
Easwaran ParamasivamAsked:
Who is Participating?
Kyle AbrahamsSenior .Net DeveloperCommented:
Kyle AbrahamsSenior .Net DeveloperCommented:
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.
Easwaran ParamasivamAuthor Commented:
Thanks for your comments. But I would like to get answer for the questiong I mentioned above. Could you please give more points?
Easwaran ParamasivamAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.