Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating an asynchronous web service

Is it possible to create a C# web service which can be called asynchronously without the autogenerated client needing to provide a synchronisation via multithreading.

like image 229
Matt W Avatar asked Jul 29 '26 05:07

Matt W


1 Answers

Yes, the auto-generated proxy always contains both synchronous and asynchronous versions of every method. For instance, if the server exposes a method called DoWork, the proxy will contain both a DoWork method and a DoWorkAsync method. When the Async version of the method completes it's work, the proxy raises a completed event, in this case DoWorkCompleted. The return value from the DoWork method will be included in the event args .

like image 78
Steven Doggart Avatar answered Jul 31 '26 17:07

Steven Doggart



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!