【问题标题】:Azure Media Service : Retry failed after 6 tries. (The operation was canceled.)Azure 媒体服务:重试 6 次后失败。 (操作被取消。)
【发布时间】:2021-06-30 07:11:50
【问题描述】:

要了解 Azure 媒体服务,我正在关注 Tutorial: Upload, encode, and stream videos with Media Services v3。 但目前卡在本文中给出的代码UploadEncodeAndStreamFilesawait blob.UploadAsync(fileToUpload); 文件上传期间抛出Retry failed after 6 tries. (The operation was canceled.) 异常。

private static async Task<Asset> CreateInputAssetAsync(
        IAzureMediaServicesClient client,
        string resourceGroupName,
        string accountName,
        string assetName,
        string fileToUpload)
    {
        // In this example, we are assuming that the asset name is unique.
        //
        // If you already have an asset with the desired name, use the Assets.Get method
        // to get the existing asset. In Media Services v3, the Get method on entities returns null 
        // if the entity doesn't exist (a case-insensitive check on the name).

        // Call Media Services API to create an Asset.
        // This method creates a container in storage for the Asset.
        // The files (blobs) associated with the asset will be stored in this container.
        Asset asset = await client.Assets.CreateOrUpdateAsync(resourceGroupName, accountName, assetName, new Asset());

        // Use Media Services API to get back a response that contains
        // SAS URL for the Asset container into which to upload blobs.
        // That is where you would specify read-write permissions 
        // and the exparation time for the SAS URL.
        var response = await client.Assets.ListContainerSasAsync(
            resourceGroupName,
            accountName,
            assetName,
            permissions: AssetContainerPermission.ReadWrite,
            expiryTime: DateTime.UtcNow.AddHours(4).ToUniversalTime());

        var sasUri = new Uri(response.AssetContainerSasUrls.First());

        // Use Storage API to get a reference to the Asset container
        // that was created by calling Asset's CreateOrUpdate method.  
        BlobContainerClient container = new BlobContainerClient(sasUri);
        BlobClient blob = container.GetBlobClient(Path.GetFileName(fileToUpload));

        // Use Strorage API to upload the file into the container in storage.
        await blob.UploadAsync(fileToUpload);

        return asset;
    }

以下是详细的异常和异常跟踪:

Count = 6
Data: {System.Collections.ListDictionaryInternal}
HResult: -2146233088
HelpLink: null
InnerException: {"The operation was canceled."}
InnerExceptions: Count = 6
Message: "Retry failed after 6 tries. (The operation was canceled.) (The operation was canceled.) (The operation was canceled.) (The operation was canceled.) (The operation was canceled.) (The operation was canceled.)"
Source: "Azure.Core"
StackTrace: "   at Azure.Core.Pipeline.RetryPolicy.<ProcessAsync>d__11.MoveNext()\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.<ProcessAsync>d__1.MoveNext()\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.<ProcessAsync>d__1.MoveNext()\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.<ProcessAsync>d__1.MoveNext()\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAnd

DebuggerNotification(Task task)\r\n 在 Azure.Storage.Blobs.BlobRestClient.BlockBlob.d__0.MoveNext()\r\n 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System .Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable1.ConfiguredValueTaskAwaiter.GetResult()\r\n 在 Azure.Storage.Blobs.Specialized.BlockBlobClient.d__26 .MoveNext()\r\n 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 System.Runtime.CompilerServices.ConfiguredTaskAwaitable 1.ConfiguredTaskAwaiter.GetResult()\r\n at Azure.Storage.Blobs.Specialized.BlockBlobClient.&lt;&gt;c__DisplayClass48_0.&lt;&lt;GetPartitionedUploaderBehaviors&gt;b__0&gt;d.MoveNext()\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Thro w()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()\r\n 在 Azure.Storage.PartitionedUploader2.&lt;UploadInternal&gt;d__19.MoveNext()\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()\r\n 在 Azure.Storage.Blobs.BlobClient.d__29.MoveNext()\r \n 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime.CompilerServices.TaskAw aiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()\r\n at Azure.Storage.Blobs.BlobClient.&lt;UploadAsync&gt;d__28.MoveNext()\r\n at System.Runtime.ExceptionSe rvices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()\r\n 在 Azure.Storage.Blobs.BlobClient.d__20.MoveNext()\r\ n 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()\r\n at Azure.Storage.Blobs.BlobClient.&lt;UploadAsync&gt;d__16.MoveNext()\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter。 GetResult()\r\n 在 Azure.Storage.Blobs.BlobClient.d__12.MoveNext()\r\n 在 System.Run time.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter1.GetResult()\r\n at UploadEncodeAndStreamFiles.Program.&lt;CreateInputAssetAsync&gt;d__7.MoveNext() in C:\\Study\\Test Source Code\\Video Portal\\media-services-v3-dotnet-tutorials-master\\AMSV3Tutorials\\UploadEncodeAndStreamFiles\\Program.cs:line 210\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()\r\ n at UploadEncodeAndStreamFiles.Program.d__4.MoveNext() in C:\Study\Test Source Code\Video Portal\media-services-v3-dotnet-tutorials-master\AMSV3Tutorials\UploadEncodeAndStreamFiles\Program.cs:line 82\r\n在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime.Comp ilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n at UploadEncodeAndStreamFiles.Program.d__3.MoveNext() in C:\Study\Test Source Code\Video Portal\media-services-v3-dotnet-tutorials-master\AMSV3Tutorials\UploadEncodeAndStreamFiles\Program.cs:line 34" 目标站点:{Void MoveNext()}

{"The operation was canceled."}
CancellationToken: IsCancellationRequested = true
Data: {System.Collections.ListDictionaryInternal}
HResult: -2146233029
HelpLink: null
InnerException: {"Error while copying content to a stream."}
Message: "The operation was canceled."
Source: "System.Net.Http"
StackTrace: "   at System.Net.Http.HttpConnection.<SendAsyncCore>d__53.MoveNext()\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()\r\n   at System.Net.Http.HttpConnectionPool.<SendWithNtConnectionAuthAsync>d__48.MoveNext()\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()\r\n   at System.Net.Http.HttpConnectionPool.<SendWithRetryAsync>d__47.MoveNext()\r\n   at System.Runtime.ExceptionServices.Exce

ptionDispatchInfo.Throw()\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在系统.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()\r\n at System.Net.Http.RedirectHandler.&lt;SendAsync&gt;d__4.MoveNext()\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()\r\n 在 System.Net.Http.HttpClient.d__71.MoveNext()\r\n 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() \r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwa iter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()\r\n at Azure.Core.Pipeline.HttpClientTransport.d__7.MoveNext()\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n n 在 Azure.Core.Pipeline.RequestActivityPolicy.d__10.MoveNext()\r\n 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 Azure.Core.Pipeline.RequestActivityPolicy.d__9.MoveNext()\r\n 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw( )\r\n 在 System.Runtime.Compiler Services.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Azure.Core.Pipeline.ResponseBodyPolicy.d__5.MoveNext()\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n n 在 Azure.Core.Pipeline.ResponseBodyPolicy.d__3.MoveNext()\r\n 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 Azure.Core.Pipeline.LoggingPolicy.d__8.MoveNext()\r\n 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw( )\r\n 在 System.Runtime.CompilerServices.TaskAwaite r.ThrowForNonSuccess(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 Azure.Core.Pipeline.LoggingPolicy.d__7.MoveNext()\r\n 在系统。 Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.d__1.MoveNext()\r\n 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\r\n n 在 Azure.Core.Pipeline.RetryPolicy.d__11.MoveNext()" 目标站点:{无效 MoveNext()} 任务:空

{"Error while copying content to a stream."}
Data: {System.Collections.ListDictionaryInternal}
HResult: -2146232800
HelpLink: null
InnerException: {"Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request.."}
Message: "Error while copying content to a stream."
Source: "System.Net.Http"
StackTrace: "   at System.Net.Http.HttpContent.<CopyToAsyncCore>d__49.MoveNext()\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Net.Http.HttpConnection.<SendRequestContentAsync>d__58.MoveNext()\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Net.Http.HttpConnection.<SendAsyncCore>d__53.MoveNext()"
TargetSite: {Void MoveNext()}


{"Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request.."}
Data: {System.Collections.ListDictionaryInternal}
HResult: -2146232800
HelpLink: null
InnerException: {"The I/O operation has been aborted because of either a thread exit or an application request."}
Message: "Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request.."
Source: "System.Net.Sockets"
StackTrace: "   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)\r\n   at System.Net.Security.SslStream.<<WriteSingleChunk>g__CompleteAsync|210_1>d`1.MoveNext()\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Net.Security.SslStream.<WriteAsyncChunked>d__209`1.MoveNext()\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Net.Security.SslStream.<WriteAsyncInternal>d__216`1.MoveNext()\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.

HandleNonSuccessAndDebuggerNotification(Task task)\r\n 在 System.Net.Http.HttpConnection.d__66.MoveNext()\r\n 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime .CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\r\n 在 System.IO.Stream.d__30.MoveNext()\r\n 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime .CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 Azure.Core.RequestContent.StreamContent.d__6.MoveNext()\r\n在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r \n 在 Azure.Core.Pipeline.HttpClientTransport.PipelineRequest.PipelineContentAdapter。d__8.MoveNext()\r\n 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\r\n 在 System.Runtime。 CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\r\n 在 System.Net.Http.HttpContent.d__49.MoveNext()" TargetSite: {Void ThrowException(System.Net.Sockets.SocketError, System.Threading.CancellationToken)}

{"The I/O operation has been aborted because of either a thread exit or an application request."}
Data: {System.Collections.ListDictionaryInternal}
ErrorCode: 995
HResult: -2147467259
HelpLink: null
InnerException: null
Message: "The I/O operation has been aborted because of either a thread exit or an application request."
NativeErrorCode: 995
SocketErrorCode: OperationAborted
Source: null
StackTrace: null
TargetSite: null

有没有其他人遇到过这样的问题?如果是,您能否帮助解决可能导致此问题的原因?我是否缺少导致此问题的权限?

【问题讨论】:

    标签: c# .net azure azure-media-services


    【解决方案1】:

    我收到此错误:“重试 6 次后失败”

    对我来说是 CORS 问题。
    转到 Azure 存储.. 在设置中找到 CORS

    为您的 LocalHost 和 WebURL 添加逗号分隔值以访问存储。

    为 AllowedHeaders 添加 *

    为 ExposedHeaders 添加 *

    添加 MaxAge = 5

    勾选你想要的所有方法......(GET,POST等......)

    这为我摆脱了“重试失败 6 次错误”,并且我能够上传我的 blob。我使用的是 BlazorWASM,但对于 web 上的所有其他项目类型来说确实应该是相同的。

    【讨论】:

      【解决方案2】:

      当您处于低带宽上传网络时,这似乎会发生。你可以添加

      BlobUploadOptions upOptions = new BlobUploadOptions
              {
                  TransferOptions = new StorageTransferOptions
                  {
                      MaximumTransferSize = 4 * 1024 * 1024,
                      InitialTransferSize = 4 * 1024 * 1024
                  }
              };
              // Use Strorage API to upload the file into the container in storage.
              await blob.UploadAsync(file,upOptions);
      

      这将改变块大小并使其在较低带宽下工作。

      【讨论】:

        【解决方案3】:

        我同意 Jason 的回答,只是做了一些修改。

        首先,我将删除无休止的 while 循环。 其次,参考github issue thread,我认为最重要的一点是在构造BlobContainerClientBlobClient时应该传递BlobClientOptions。然后指定传输。 正如线程中提到的here Tweaking Transport in BlobClientOptions

        new BlobClientOptions
        {
            Transport = new HttpClientTransport(
                new HttpClient { Timeout = TimeSpan.FromSeconds(102) })
        };
        

        我在 Jason 的评论中看到上面的内容,他把这个注释掉了,但这将是解决问题的一个组成部分。

        您还可以考虑延长重试周期,此请求需要 6 次以上才能成功连接。

        new BlobClientOptions // or whatever options class suitable for your client
        {
            Transport = new HttpClientTransport( new HttpClient { Timeout = Timeout.InfiniteTimeSpan } ),
            Retry = { NetworkTimeout = Timeout.InfiniteTimeSpan }
        }
        

        【讨论】:

          【解决方案4】:

          您需要更改以下代码。

          var sasUri = new Uri(response.AssetContainerSasUrls.First());
          // Use Storage API to get a reference to the Asset container
          // that was created by calling Asset's CreateOrUpdate method.  
          BlobContainerClient container = new BlobContainerClient(sasUri);
          BlobClient blob = container.GetBlobClient(Path.GetFileName(fileToUpload));
          // Use Strorage API to upload the file into the container in storage.
          await blob.UploadAsync(fileToUpload);
          return asset;
          

          尝试使用我的示例代码,然后告诉我测试结果,它是否解决了您的问题。

          var sasUri = new Uri(response.AssetContainerSasUrls.First());
          //var options = new BlobClientOptions
          //{
          //    Transport = new HttpClientTransport(
          //        new HttpClient { Timeout = TimeSpan.FromSeconds(102) })
          //};
          var container = new Azure.Storage.Blobs.BlobContainerClient(sasUri);//,options);
          int i = 0;
          while (true)
          {
              var blob = containerClient.GetBlobClient($"yourblobname");
          
              await using (var fileStream = System.IO.File.OpenRead(fileToUpload)
              {
                  await blobClient.UploadAsync(fileStream, true, CancellationToken.None);
              }
          }
          

          更多详情,请阅读本期。

          Azure.Storage.Blobs.BlobClient.UploadAsync throws System.Net.Sockets.SocketException #9212

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2016-01-21
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多