.Net web client does not load after 2 GB with S3

I am using a web client object to upload a file as follows:

strm = Client.OpenRead(url); strm.ReadTimeout = 30000; bool bFirst = true; while ((read = strm.Read(buf, 0, 2000)) > 0) { fout.Write(buf, 0, read); } 

Where the URL points to the S3 bucket. In some cases, the download fails with a timeout of exactly 2 GB. Is this a network problem, or is there something I can change in the code?

Any ideas appreciated.

+4
source share
1 answer

I believe that WebClient will read the file in memory, and you are probably facing process size limitations.

What you want to use is WebClient.DownloadFile

I think it will be better for you!

+6
source

Source: https://habr.com/ru/post/1384374/


All Articles