// get a proxy to the Web service
customerService serviceProxy = new customerService (); //start async call to CustomerUpdate IAsyncResult result = serviceProxy.BeginCustomerUpdate(null,null);// Useful work that can be done in parallel should appear here
// but is absent here
//wait for the asynchronous operation to complete
// Client is blocked until call is done
result.AsyncWaitHandle.WaitOne(); serviceProxy.EndCustomerUpdate(result);When code like this is executed in a server application such as an ASP.NET application or Web service, it uses two threads to do one task and offers no benefit; in fact, it delays other requests being processed. This practice should be avoided.
Ref: https://msdn.microsoft.com/en-us/library/ff647790.aspx
0 comments:
Post a Comment