【问题标题】:Upload large file to aws S3 server in .Net (asp.net core)将大文件上传到.Net(asp.net核心)中的aws S3服务器
【发布时间】:2017-10-01 06:27:51
【问题描述】:

我需要将多个大文件(数 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);

【问题讨论】:

  • 您是否检查了命令行日志或 IIS 中的 aspnet 日志以确认这是超时问题?

标签: c# amazon-web-services amazon-s3 asp.net-core aws-sdk


【解决方案1】:

您能否将Timeout 参数指定为TransferUtilityUploadRequest 的一部分?

如果是这样,你可以使用一个合理的大数字,或者如果你很绝望,你可以使用-1 来表示无限。这显然是不推荐的。

相关文档: http://docs.aws.amazon.com/sdkfornet1/latest/apidocs/html/T_Amazon_S3_Transfer_TransferUtilityUploadRequest.htm

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-08-17
  • 1970-01-01
  • 2015-06-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多