I’m consuming a third-party resource (a .dll) in a web service, and my problem is, that invoking this resource (calling a method) is done asynchronous – I need to subscribe to an event, to get the answer for my request. How do I do that in a c# web service?
Update:
With regard to Sunny’s answer:
I don’t want to make my web service asynchronous.
If the 3rd party component does not support the standard asynchronous programming model (i.e it does not use IAsyncResult), you can still achieve synchronization using AutoResetEvent or ManualResetEvent. To do this, declare a field of type AutoResetEvent in your web service class:
Then wait for the event to be signaled after calling the 3rd party component
And in the callback event handler signal the event to let the waiting thread continue execution: