Why is My Web Service Taking so Long?

Sometimes we are victims of our own cleverness. I could not figure out why my web service call was taking so long. After all, the service was local, the data was a simple query to the local database, and the response was tiny. So what’s the deal? Then I found this in my code in the DownloadStringCompleted event handler:


Ugh! This was some code I had written during a demo that got copied and pasted into my code sample for my book somehow. I have been taking bits and pieces of code I have written and working them into examples. At one point I wanted to test some features when events were taking too long, so I faked it out with the Sleep method.
Anyway, problem solved, crisis averted … until next time!
DotNetKicks Image
Tweet Post Share Update RSS

Hi, I'm John Papa. I author this blog, create courses for Pluralsight and am a Google Developer Expert and Microsoft Regional Director. I travel speaking at events and train technology thought leaders