C# Amazon S3 TransferUtility.Upload在上载一个文件后挂起
大家好,我正在尝试在AmazonS3中上传.csv文件。在上传一个文件之前,它工作正常,但之后系统将挂起,接下来不会发生任何事情 我被推荐,但没有得到正确的解决方案 如果你有正确的方法,请让我知道 我的密码是她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
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非常感谢您查看此问题。我最近通过使用线程执行解决了这个问题。