Wednesday, November 19, 2008

System.Net.WebException: The operation has timed-out.

If you open more than a few connections to the same website using HttpWebRequest, then you'll likely get this misleading exception. You can fix the problem by making sure you close your HTTP connections.

HttpWebRequest r = WebRequest.Create("http://xyz");
HttpWebResponse w = r.GetResponse()
... // << do stuff here
w.Close(); // << frees the connection

This was causing some fun debugging issues for me. Just needed to close my connection.

Blog Posts by:

The Official jQuery Podcast

with Ralph Whitbeck & Rey Bango

You can subscribe to the show in iTunes or via the raw RSS feed

My Twitter Updates

View Twitter Page