Thursday, January 30, 2014

.NET WebClient.DownloadString Slow 15 Seconds

In troubleshooting a webclient.downloadstring issue, we came across a number of articles that gave this as the solution:

WebClient wc = new WebClient();
wc.Proxy = null;

This didn't work for us.  After many hours of troubleshooting, we realized that we were calling a URL with HTTPS.  The same call, with the same .NET class using PowerShell had no performance issues.  The same call from the server hosting the HTTPS end point had no performance issues.  That means that the server was calling back to itself using the same fully qualified domain name that was used from the server with the performance issue.  We switched the client to another server and it had the same performance issue, eliminating many OS possibilities.

The solution was to add the public key of the end point certificate, as a Trusted Root Authority in Internet Explorer on the "client server".  This had to be done manually.  An attempt to do this through scripts failed to resolve the issue, even though the certificate showed up. We believe the delay is due to IIS (since PowerShell has no performance issue) attempting to check the certificate revocation list.

Check This Out!

More Links to Good Information