当前位置: 首页 > 知识库问答 >
问题:

Azure媒体服务:重试6次后失败。(操作已取消。)

齐朝明
2023-03-14

为了了解Azure Media Service,我正在学习教程:使用Media Services V3上传、编码和流媒体视频。但是,由于本文中给出的代码UploadEncodeAndStreamFiles正在抛出,重试在6次后失败。(操作已取消。)等待blob.uploadAsync(fileToUpload)上载文件时出现异常;

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
{"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
{"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.
{"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

还有人面临过这样的问题吗?如果是,你能帮助什么可能导致这个问题吗?我是否丢失了导致此问题的权限?

共有1个答案

路欣荣
2023-03-14

当你在一个低带宽的上传网络上时,这似乎会发生。您可以添加

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);

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

 类似资料:
  • 我找到了一些相关的答案,但没有一个能解释我是否真的需要Azure Media Services团队示例中的所有代码https://azure.microsoft.com/en-us/documentation/articles/media-services-copying-existing-blob/我只想把一个文件从blob上传到Azure Media Services。这样地: 但是我得到了

  • 到目前为止,我已经有了一个正常运行的Azure Mobile服务,并且面向服务的OAuth在Google上工作得很好。我试图将移动服务作为应用程序服务重新宿主,因为移动服务是不推荐的。我还有一个HTML/JS web应用程序,它通过JS客户端访问我的服务。这就是乐趣开始的地方。 单击“Return to Website”将我带到应用程序服务的地址,而不是启动OAuth请求的应用程序,如果我关闭此窗

  • 因此,我试图在一个逻辑应用程序中为BLOB设置一些自定义元数据。不幸的是,目前还没有能够在BLOB上设置自定义数据的操作。 因此,作为解决办法,我尝试使用REST API设置元数据,并配置以下操作(SharedKey的格式为StorageAccountName:AccessKey1): 因此,对于x-ms-date标头,我使用了表达式utcNow(),但这似乎不能完成任务,因为我得到了以下错误消息

  • 我们已经设置了一个库伯内特斯网络抓取cron作业集群。在cron作业开始失败之前,一切似乎都很顺利(例如,当站点结构发生变化并且我们的抓取器不再工作时)。看起来偶尔会有一些失败的cron作业会继续重试,直到它导致我们的集群崩溃。运行(在集群失败之前)会显示有太多作业正在为失败的作业运行。 我试图遵循这里描述的关于pod退避失败策略的已知问题的注释;然而,这似乎不起作用。 以下是我们的配置供参考:

  • 我正在开发一个渐进式web应用程序,目的是缓存所有离线使用的资产。这是我的服务人员 无论我是否在线,服务工作人员都无法缓存一些资产(在本例中bundle.js),并破坏了我的缓存优先系统,即使我在注册工作人员时记录了一条成功消息。 https://postimg.org/gallery/2yo1ig35y/

  • 当我使用扫描仪或尝试获取用户输入时,我得到消息: 失败:生成失败,出现异常。 > 出错了:任务“:run”的执行失败。 处理“命令”C:\ProgramFiles\Java\jdk-13.0.1\bin\Java。exe“”以非零退出值1结束 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。运行--scan以获得完整的见解。 在