将现有 blob 复制到 Azure 媒体服务时出现问题

Issue while copying existing blob to Azure Media Services

我们正在尝试将现有的 blob 复制到 AMS,但它没有被复制。 Blob 驻留在存储帐户 1 中,AMS 与存储帐户 2 关联。包括 AMS 在内的所有帐户都在同一位置。

   await destinationBlob.StartCopyAsync(new Uri(sourceBlob.Uri.AbsoluteUri + signature));

使用 Blob 存储资源管理器可视化 AMS 存储帐户时,正在创建资产文件夹,但其中没有 blob。此外,在媒体资源管理器中,我们可以看到 AMS 中列出的资产,但单击时会抛出未找到异常。基本上它们没有被完全复制到 AMS 中。

但是,当我们使用相同的代码并将新的 AMS 附加到实际 blob 所在的 blob 存储帐户 (storage account1) 时,复制工作正常。

我没有重现你的问题。但是有一个 code sample 可以通过 .NET SDK 将现有的 blob 复制到 Azure 媒体服务。请尝试使用 StartCopyFromBlobStartCopyFromBlobAsync(Azure 存储客户端库 4.3.0)复制 Blob。以下是代码示例中的代码片段:

                destinationBlob.StartCopyFromBlob(new Uri(sourceBlob.Uri.AbsoluteUri + signature));

                while (true)
                {
                    // The StartCopyFromBlob is an async operation, 
                    // so we want to check if the copy operation is completed before proceeding. 
                    // To do that, we call FetchAttributes on the blob and check the CopyStatus. 
                    destinationBlob.FetchAttributes();
                    if (destinationBlob.CopyState.Status != CopyStatus.Pending)
                    {
                        break;
                    }
                    //It's still not completed. So wait for some time.
                    System.Threading.Thread.Sleep(1000);
                }