-1

I've got a list of unique Urls that essentially generate XLS files that I would like to all download at the same time. I've tried using the answer to this post: Download multiple files async and wait for all of them to finish before executing the rest of the code to no avail... I think it is because I am trying to download files that all require the same CookieContainer and session information. (In other words, this is behind a logged in / authenticated session).

Here is what I want:

  1. Download each file in the list and then process it after the individual file is completed downloading
  2. Wait for all of the files to be finished downloading and processing 2.

I'm using Fiddler to watch the files as they download, and it seems that some start to download, but almost all of them don't. Sometimes, it returns an error saying that the remote host ended the session, however, I know that the remote host can handle these multiple requests.

How do I set all of these files to download at the same time behind the authenticated session?

Community
  • 1
  • 1
Ben Holland
  • 321
  • 1
  • 8

1 Answers1

1

There's a per host per process connection limit.

Try setting ServicePoint.ConnectionLimit or ServicePointManager.DefaultConnectionLimit.

Paulo Morgado
  • 14,111
  • 3
  • 31
  • 59
  • I thought this worked at first, but it turns out that the remote host is rejecting any more than two connections. I know it's not my ServicePointManager, because I print the default connection limit right before the request and it is much higher than two. Is there a way to tell the remote host that I need to raise the connection limit? What am I doing wrong? – Ben Holland Jul 28 '15 at 21:55
  • Do you control the server? what kind of server is it? – Paulo Morgado Jul 28 '15 at 22:20
  • I do not control the server. I'm simply trying to download multiple files at once from a server. I don't know what kind exactly, but I do know it is Apache – Ben Holland Jul 29 '15 at 01:31
  • IF you don't control the server, there's nothing you can do. Those limitations are in place to protect the systems and keep them responsive. Would you like if anyone that phones you could change any settings on your phone, for example? – Paulo Morgado Jul 29 '15 at 06:19