In the ASP.NET WebForms website (IIS, the only application pool) I have a call to a long web service method that is referenced in Visual Studio as a Service Reference (.NET 4.0). Unfortunately, I have to wait for information from the web service before I can serve the page for the user. The web service is currently called synchronously, so the server cannot use the current thread to process other requests that have a performance impact.
Of course, I can generate asynchronous operations to refer to the service in Visual Studio and call BeginGetFoo instead of GetFoo , but still I have to somehow wait for the result from the web service.
That is the question. If I use AsyncWaitHandle.WaitOne (as shown below), would it be better to use all the application performance conditions from the synchronous call that I use today?
IAsyncResult result = fooSoapClient.BeginGetFoo(); result.AsyncWaitHandle.WaitOne(); var foo = fooSoapClient.EndGetFoo(result);
And of course, if waiting can be done better, I am open to suggestions.
Pol
source share