.NET web service call slower when performed asynchronously

Posted by joelt on Stack Overflow See other posts from Stack Overflow or by joelt
Published on 2010-05-27T18:37:47Z Indexed on 2010/05/27 18:41 UTC
Read the original article Hit count: 165

Filed under:
|
|

I have an ASP.NET site, and some pages need to call a web service. I used Visual Studio's "Add Web Reference" to auto-generate classes and methods for the web service. When I call the service synchronously, i.e. objService.MethodName("param1"), a call might take a second or so. When I call it asynchronously, i.e., objService.BeginMethodName("param1", AddressOf MyCallback, Nothing), it typically takes about 6 seconds. When debugging, it appears that the bulk of the time is spent waiting between the completion of the BeginMethodName call and the beginning of MyCallback. Does the thread switching really incur that much overhead? Is there another reason for this?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about web-services