Copy page blob from one storage account to Another storage account using .Net API startCopy

送分小仙女□ 提交于 2019-12-25 08:00:03

问题


I am trying to copy a page blob in one storage account to another storage account using .net API startCopy. Both storage accounts are standard type and blob exists in source location. I am getting "cannotverifysourcepath" error with below exception details.

I was hoping that startcopy API works to copy from account to another. Can anyone please help me to figure out what's the issue here?

Exception- Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (404) Not Found. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   --- End of inner exception stack trace ---
   at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.StartCopy(Uri source, AccessCondition sourceAccessCondition, AccessCondition destAccessCondition, BlobRequestOptions options, OperationContext operationContext)
   at Microsoft.WindowsAzure.Storage.Blob.CloudPageBlob.StartCopy(CloudPageBlob source, AccessCondition sourceAccessCondition, AccessCondition destAccessCondition, BlobRequestOptions options, OperationContext operationContext)
Request Information
RequestID:1a82f5b6-0001-008f-7328-26bec1000000
RequestDate:Fri, 14 Oct 2016 14:35:31 GMT
StatusMessage:The specified resource does not exist.
ErrorCode:CannotVerifyCopySource

回答1:


You can try using the data movement library. Specifically:

await TransferManager.CopyAsync(source, target, false);

The boolean parameter specifies whether or not this is a service-side asynchronous copy. If it is, the local task may complete before the copy is complete.

I have verified that this works when source and target are in different accounts and both access policies are 'private.'




回答2:


For copying blob across storage accounts, source blob must be publicly accessible. Please check the ACL on the source blob container and see if it is Private.

If the source blob container's ACL is Private, there are two possible solutions:

  1. Create a Shared Access Signature (SAS) on the source blob with at least Read permission and an expiry date of at least 15 days and use that SAS URL (blob URL + SAS token) as copy source.
  2. Not recommended, but you can change the ACL of the source blob container to Blob. This will make the source blob publicly accessible. Your code should work as is in that case.


来源:https://stackoverflow.com/questions/40049127/copy-page-blob-from-one-storage-account-to-another-storage-account-using-net-ap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!