Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to upload files to Amazon S3 (official SDK) that are larger than 5 MB (approx)?
    primarykey
    data
    text
    <p>I am using the latest version of the official Amazon S3 SDK (1.0.14.1) to create a backup tool. So far everything works correctly if the size of the file I'm uploading is below 5 MB, but when any of the files is above 5 MB the upload fails with the following exception:</p> <blockquote> <p>System.Net.WebException: The request was aborted: The request was canceled. ---> System.IO.IOException: Cannot close stream until all bytes are written. at System.Net.ConnectStream.CloseInternal(Boolean internalCall, Boolean aborting) --- End of inner exception stack trace --- at Amazon.S3.AmazonS3Client.ProcessRequestError(String actionName, HttpWebRequest request, WebException we, HttpWebResponse errorResponse, String requestAddr, WebHeaderCollection&amp; respHdrs, Type t) at Amazon.S3.AmazonS3Client.Invoke[T](S3Request userRequest) at Amazon.S3.AmazonS3Client.PutObject(PutObjectRequest request) at BackupToolkit.S3Module.UploadFile(String sourceFileName, String destinationFileName) in W:\code\AutoBackupTool\BackupToolkit\S3Module.cs:line 88 at BackupToolkit.S3Module.UploadFiles(String sourceDirectory) in W:\code\AutoBackupTool\BackupToolkit\S3Module.cs:line 108</p> </blockquote> <p><strong>Note</strong>: 5 MB is roughly the boundary of failure, it can be slightly lower or anything higher</p> <p>I am assuming that the connection is timing out and the stream is being automatically closed before the file upload completes. </p> <p>I've tried to find a way to set a long timeout (but I can't find the option in either <code>AmazonS3</code> or <code>AmazonS3Config</code>). </p> <p>Any ideas on how to increase the time-out (like an application wide setting I can use) or is it unrelated to a timeout issue?</p> <hr> <p><em>Code:</em></p> <pre><code>var s3Client = AWSClientFactory.CreateAmazonS3Client(AwsAccessKey, AwsSecretKey); var putObjectRequest = new PutObjectRequest { BucketName = Bucket, FilePath = sourceFileName, Key = destinationFileName, MD5Digest = md5Base64, GenerateMD5Digest = true }; using (var upload = s3Client.PutObject(putObjectRequest)) { } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload