我看到有一个CloudFile.StartCopy()
方法,但我怎么能阻止它完成?这example建议调用StartCopy()
,然后调用destFile.DownloadText()
,我认为会阻止但我不想重新下载一个可能相当大的文件只是为了阻止。
不确定这是否回答了“阻止”部分,但这是我在类似的情况下所做的事情。我希望它有所帮助。
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);