Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a big problem with WebClient class on Windows Server 2008. I have small code that downloads data from web using WebClient.DownloadFile/DownloadData method. Everything works ok on Windows 2003 and Windows 7, but not on Windows Server 2008. On 2008 I get a very low speed (about 5kb/s where normaly I have about 1mb/s).

I did some research and checking: - problem only exists on couple of servers (not every one, one of it is -> example file, - I checked a couple of servers with 2008 - diffrent machines, different network connections - problem existed at each one. - I tried the trick with setting proxy to null or empty - didnt help - I used wireshark to check what is wrong - I didnt notice anything weird, just lower speed. - if I create a virtual machine with windows 2003 at windows 2008 and install downloader at win2k3 it works ok.

Thanks for help.


class Program
    static void Main(string[] args)
        string file1 = "";
        string file2 = "";

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



share|improve this question

migrated from Mar 7 '11 at 13:51

This question came from our site for professional and enthusiast programmers.

But if I try to download content with webbrowser (firefox or internet explorer) speed is ok. Problem with speed exists only when I use WebClient class - so for me its programming related. – Dariusz Sroka Mar 7 '11 at 6:31

I have a blog post on my blog that goes into performing multiple http requests using HttpWebRequest and asynchronous class (for performance). HttpWebRequest - Asynchronous Programming Model/Task.Factory.FromAsyc

Noe you may not be keen to use async programming but nonetheless there are some settings you need to change in order to get more than 2 simultaneous http class and that's also explained in the post I've linked to above. Specifically, you need to modify the ServicePointManager's DefaultConnectionLimit property (which is set to 2 per domain by default).

So if you're calling the same domain multiple times, then changing this value to a larger number will make a huge difference in the performance you're seeing.

Since making http requests and downloading files are purely I/O workloads, you should seriously look at using asynchronous calls in your case too. There are multiple examples/styles I've shown in the post that you could use. Even WebClient uses the Event based Async programming model, that you might want to look at using.

share|improve this answer
Hi, I updated my question with example code to show how simple it is. I'm not doing anything asynchronous or multiple http requests at time. Its just one request after one (first request is slow too, its not a problem with next requests.. each one is very slow). – Dariusz Sroka Mar 7 '11 at 10:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.