来自Blob的Azure存储副本
我在转换此处描述的控制台应用程序时遇到问题。在移动应用程序服务上运行 我有类似的参考和代码,但有以下问题来自Blob的Azure存储副本,azure,azure-storage,azure-mobile-services,azure-media-services,Azure,Azure Storage,Azure Mobile Services,Azure Media Services,我在转换此处描述的控制台应用程序时遇到问题。在移动应用程序服务上运行 我有类似的参考和代码,但有以下问题 // Display the size of the source blob. Console.WriteLine(sourceBlob.Properties.Length); Console.WriteLine(string.Format("Copy blob '{0}' to '{1}'", sourceBlob.Uri, destinationBlob.Uri)); // The l
// Display the size of the source blob.
Console.WriteLine(sourceBlob.Properties.Length);
Console.WriteLine(string.Format("Copy blob '{0}' to '{1}'", sourceBlob.Uri, destinationBlob.Uri));
// The line below gives the following error:
destinationBlob.StartCopyFromBlob(new Uri(sourceBlob.Uri.AbsoluteUri + signature));
大宗报价
“ICloudBlob”不包含“StartCopyFromBlob”的定义,并且找不到接受类型为“ICloudBlob”的第一个参数的扩展方法“StartCopyFromBlob”(是否缺少using指令或程序集引用
这是因为我正在使用存储客户端的版本7,并且该方法已被删除吗
如果有,是否有一种新的方法组合,我可以使用它来获得类似的结果?从中,您可以找到:
Blob:删除了不推荐的(开始/结束)StartCopyFromBlob(异步)API,支持使用(开始/结束)StartCopy(异步)API
因此,请使用而不是StartCopyFromBlob。正如肇星路所说,“ICloudBlob”不包含“StartCopy”的定义。根据您的代码,您可以在
CloudBlockBlob
类中找到“StartCopy”
根据您提到的教程,您可以修改destinationBlob的类型:
CloudBlockBlob destinationBlob = destinationContainer.GetBlockBlobReference(sourceBlob.Name);
而不是:
ICloudBlob destinationBlob = destinationContainer.GetBlockBlobReference(sourceBlob.Name);
注意:CloudBlockContainer.GetBlockBlobReference
返回一个CloudBlockBlob
对象
然后可以运行以下代码:
destinationBlob.StartCopy(new Uri(sourceBlob.Uri.AbsoluteUri + signature));
但是ICloudBlob接口没有名为Startcopy的方法。它不存在于ICloudBlob接口中,它存在于cloudblob基类中。