System.OperationCanceledException:操作已取消-AWS File Services

时间:2019-01-23 02:40:31

标签: c# amazon-web-services windows-10 hyper-v

我正在尝试解决获取/上传文件的问题。 错误的根本原因是文件服务在测试服务器中不起作用。 但是正在我的本地计算机上工作。

试图找出是什么阻止或限制了该服务在测试服务器上运行。

这是引发的异常:

{"":["System.OperationCanceledException: The operation was canceled.
at System.Net.Http.HttpClient.HandleFinishSendAsyncError(Exception e, 
CancellationTokenSource cts)  
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, 
HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)   
at System.Net.Http.HttpClient.GetStringAsyncCore(Task`1 getTask)  
at Amazon.Runtime.Internal.Util.AsyncHelpers.<>c__DisplayClass1_1`1. 
<<RunSync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown --- 
at Amazon.Runtime.Internal.Util.AsyncHelpers.ExclusiveSynchronizationContext.BeginMessageLoop() 
at Amazon.Runtime.Internal.Util.AsyncHelpers.RunSync[T](Func`1 task)
at Amazon.Util.AWSSDKUtils.DownloadStringContent(Uri uri, TimeSpan timeout, IWebProxy proxy)  
at Amazon.Util.EC2InstanceMetadata.GetItems(String relativeOrAbsolutePath, Int32 tries, Boolean slurp)
at Amazon.Util.EC2InstanceMetadata.get_IAMSecurityCredentials()   
at Amazon.Runtime.DefaultInstanceProfileAWSCredentials.FetchCredentials()   
at Amazon.Runtime.DefaultInstanceProfileAWSCredentials.GetCredentials() 
at Amazon.Runtime.DefaultInstanceProfileAWSCredentials.GetCredentialsAsync()  
at Amazon.Runtime.Internal.CredentialsRetriever.InvokeAsync[T](IExecutionContext executionContext) 
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext) 
at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext) 
at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)   
at Amazon.S3.Internal.AmazonS3ExceptionHandler.InvokeAsync[T](IExecutionContext executionContext) 
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionContext executionContext) 
at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext executionContext)  
at Sms.Office.PacmsTri.Services.File.FileStorage.WriteFileAsync(Stream file, String contentType, String filename, CancellationToken token) in C:\\agent\\_work\\1\\s\\source\\PacmsTri\\Services\\File\\FileStorage.cs:line 57
at Sms.Office.PacmsTri.Services.ReportServer.UploadAndGetFileStorageIdAsync(Stream outputStream, String fileName, String generatedfilename) in C:\\agent\\_work\\1\\s\\source\\PacmsTri\\Services\\ReportServer.cs:line 161 
at Sms.Office.PacmsTri.Areas.Pacms.Controllers.PurchaseShipListController.EstimateCondition_Send(String qNo, Int32 orderByNum, String CcNames, String CcEmails, String ToSupplier, CancellationToken token) in C:\\agent\\_work\\1\\s\\source\\PacmsTri\\Areas\\Pacms\\Controllers\\PurchaseShipListOrder.cs:line 2792"]} 

1 个答案:

答案 0 :(得分:0)

我已通过为系统中缺少的AWS类设置环境变量来解决此问题。非常感谢。