将现有blob复制到Azure Media Services时出现问题

时间:2016-09-20 14:49:27

标签: azure azure-storage-blobs azure-media-services

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

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

使用Blob Storage Explorer可视化AMS存储帐户时,会创建资产文件夹但其中没有blob。此外,在Media Explorer中,我们可以看到AMS中列出的资产,但单击时,不会发现异常。基本上他们没有完全复制到AMS。

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

1 个答案:

答案 0 :(得分:0)

我没有重现你的问题。但是有一个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);
                }