Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/337.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Amazon S3 TransferUtility.Upload在上载一个文件后挂起_C#_Amazon S3 - Fatal编程技术网

C# Amazon S3 TransferUtility.Upload在上载一个文件后挂起

C# Amazon S3 TransferUtility.Upload在上载一个文件后挂起,c#,amazon-s3,C#,Amazon S3,大家好,我正在尝试在AmazonS3中上传.csv文件。在上传一个文件之前,它工作正常,但之后系统将挂起,接下来不会发生任何事情 我被推荐,但没有得到正确的解决方案 如果你有正确的方法,请让我知道 我的密码是她 public static void UploadScreenShot(string FullFilePath, string DestPath, string FileName) { try { TransferU

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

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

如果你有正确的方法,请让我知道

我的密码是她

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{}
}

我在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);
            }            
        }
var response=await base.InvokeAsync(executionContext).ConfigureAwait(false);
公共重写异步System.Threading.Tasks.Task InvokeAsync(IExecutionContext executionContext)
{
executionContext.RequestContext.Metrics.AddProperty(Metric.AsyncCall,true);
尝试
{
executionContext.RequestContext.Metrics.StarteEvent(Metric.ClientExecuteTime);
var response=await base.InvokeAsync(executionContext).ConfigureAwait(false);
返回响应;
}
最后
{
executionContext.RequestContext.Metrics.StopEvent(Metric.ClientExecuteTime);
这是LogMetrics(executionContext);
}            
}

最后我在他们的github上安装了一个bug

@BharatPrajapati这是什么意思?“线程可以正常工作”?如果为每个文件分配唯一的线程,则不会挂起。而且应用程序运行良好。Amazon在其产品的v2.3.1.0中解决了这个问题SDK@user384080非常感谢您查看此问题。我最近通过使用线程执行解决了这个问题。