代码之家  ›  专栏  ›  技术社区  ›  sirdank ben

Azure文件存储-复制时阻止

  •  0
  • sirdank ben  · 技术社区  · 8 年前

    我看到有一个 CloudFile.StartCopy() example 建议致电 StartCopy() 然后打电话来 destFile.DownloadText() 我认为这会阻止,但我不想重新下载一个可能很大的文件只是为了阻止。

    1 回复  |  直到 8 年前
        1
  •  1
  •   Simon Wilson    8 年前

    不确定这是否回答了“块”部分,但这是我在类似情况下做的事情。希望对你有帮助。

       var target = _container.GetBlockBlobReference(targetItemName);
    
       // StartCopy will add a request to a queue, that's all
       target.StartCopy(source);
    
       // Now we poll the copy's status
       while (target.CopyState.Status == CopyStatus.Pending)
            await Task.Delay(500);
    
       if (target.CopyState.Status != CopyStatus.Success)
            throw new ApplicationException("Copy failed: " + target.CopyState.Status);