OMG. I want to strangle someone!
For the past week or so, I’ve been dealing with an issue where a simple UploadValues call to the WebClient object was taking 10-30 seconds instead of the nearly-instance response time I was expecting.
I’ve tried going at it from different angles.
I’ve done everything I could possibly think of. I tried using HttpWebRequest/HttpWebResponse. I tried explicitly turning off the proxy check. You name it and there’s a good chance I attempted it.
Today, though, I finally had a breakthrough.
I was looking at a TCP trace from the connection and noticed the responses being returned from the site were ‘chunked’.
Even though it’s something I’m sure .NET has handlers for, I figured it was worth looking into. It’s not a feature my client can tell the server not to use, per se, but since it was functionality added to the HTTP 1.1 protocol, I decided to find a way to force the request to use HTTP 1.0.
Unbelievably, that did it.
The response time went from roughly 20-sec to 1-sec. I was ecstatic and — at the same time — I was also pretty ticked-off.
Was it the chunking that was the issue or another HTTP 1.1 feature? Was the site misconfigured somehow? Is it a known issue?
I still have a lot of questions remaining… and some more research to do. At least I have a workaround now.