I'm using Windows 7 Ultimate x64.
I've first had a browse and found this where I got the 'solution' to the issue but would like to know why - I dont want to null the DefaultWebProxy in case there is a legitimate proxy that should be used. (btw I am not behind an http proxy)
Here is a simple unit test that demostrates the issue.
[Test]
public void TestWebRequest()
{
//if I dont include the following line the request takes ~40 seconds.
WebRequest.DefaultWebProxy = null;
var httpRequest = WebRequest.Create("http://google.com");
var stopWatch = new Stopwatch();
stopWatch.Start();
using (var webResponse = httpRequest.GetResponse())//this is the line taking ages.
{
using (var sr = new StreamReader(webResponse.GetResponseStream()))
Trace.WriteLine(sr.ReadToEnd());
}
stopWatch.Stop();
Trace.WriteLine(string.Format("took {0} sec", stopWatch.Elapsed.TotalSeconds));
}
Can we please not get bogged down on IDisposable causes.