【问题标题】:Amazon S3 TransferUtility.Upload hangs after one file uploaded上传一个文件后,Amazon S3 TransferUtility.Upload 挂起
【发布时间】:2014-09-27 14:35:39
【问题描述】:

大家好,我正在尝试在 amazon S3 中上传 .csv 文件,它可以正常工作,直到上传一个文件,但之后系统挂起,接下来不会发生任何事情。

我推荐了this,但没有得到正确的解决方案。

如果你有正确的方法,请告诉我。

我的密码是她

public static void UploadScreenShot(string FullFilePath, string DestPath, string FileName)
{
        try
        {
                    TransferUtility fileTransferUtility = new TransferUtility(new AmazonS3Client(Amazon.RegionEndpoint.USEast1));
                    fileTransferUtility.Upload(FullFilePath, existingBucketName, DestPath +FileName);
                    fileTransferUtility.Dispose();
        }
        catch{}
}

【问题讨论】:

    标签: c# amazon-s3


    【解决方案1】:

    我在 AWS SDK 2.3 上有这个,它在 AWS SDK 2.2.2 上运行良好。我还没有弄清楚为什么它会被锁定。 我在网上锁定了这个方法

    var response = await base.InvokeAsync<T>(executionContext).ConfigureAwait(false); 
    
    public override async System.Threading.Tasks.Task<T> InvokeAsync<T>(IExecutionContext executionContext)
            {
                executionContext.RequestContext.Metrics.AddProperty(Metric.AsyncCall, true);
                try
                {
                    executionContext.RequestContext.Metrics.StartEvent(Metric.ClientExecuteTime);
                    var response = await base.InvokeAsync<T>(executionContext).ConfigureAwait(false);    
                    return response;                              
                }
                finally
                {
                    executionContext.RequestContext.Metrics.StopEvent(Metric.ClientExecuteTime);
                    this.LogMetrics(executionContext);
                }            
            }
    

    我最终在他们的 github 上提交了一个错误。 https://github.com/aws/aws-sdk-net/issues/137

    【讨论】:

    • @BharatPrajapati 这是什么意思? “它适用于线程”?
    • 如果您为每个文件分配唯一的线程,那么它就不会挂起。并且应用程序工作正常。
    • 亚马逊在其 SDK 的 v2.3.1.0 中修复了此问题
    • @user384080 非常感谢您查看此问题。我最近通过使用线程执行解决了这个问题。
    猜你喜欢
    • 2012-01-11
    • 1970-01-01
    • 1970-01-01
    • 2020-10-15
    • 1970-01-01
    • 2014-02-03
    • 1970-01-01
    • 1970-01-01
    • 2016-01-10
    相关资源
    最近更新 更多