[英]Upload large file to aws S3 server in .Net (asp.net core)
我需要將多個大文件(幾GB)上傳到AWS S3服務器。 我寫了基本代碼,但它給出了錯誤 -
HTTP Error 502.3 - Bad Gateway
The specified CGI application encountered an error and the server terminated the process.
可能是由於超時。 那么,有沒有完美的方法將大文件上傳到s3。 我使用下面的代碼 -
TransferUtility fileTransferUtility = new TransferUtility(this._s3Client);
TransferUtilityUploadRequest fileTransferUtilityRequest = new TransferUtilityUploadRequest
{
BucketName = s3BucketName,
FilePath = filePath,
PartSize = 6291456,
Key = key,
CannedACL = S3CannedACL.PublicRead
};
fileTransferUtilityRequest.UploadProgressEvent += FileTransferUtilityRequest_UploadProgressEvent;
fileTransferUtility.Upload(fileTransferUtilityRequest);
您可以將Timeout
參數指定為TransferUtilityUploadRequest
一部分嗎?
如果是這樣,你可以使用合理的大數,或者如果你絕望,你可以使用-1
無限。 顯然不推薦這樣做。
相關文檔: http : //docs.aws.amazon.com/sdkfornet1/latest/apidocs/html/T_Amazon_S3_Transfer_TransferUtilityUploadRequest.htm
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.