【发布时间】:2014-08-17 08:12:56
【问题描述】:
我在通过 nuget 包管理器升级到 4.0.1.0 后开始遇到这种情况。然后我升级到 4.1.0.0 希望它可能是一个错误,但仍然是同样的问题。
我使用的是基于云的 Azure 存储,而不是模拟器。
我之前使用的是 3.0.3.0,它可以工作,当我切换到这个版本时仍然可以工作。
这是整个方法(基本上是从一个容器复制一个 blob 到另一个容器)
public string CopyBlobs(string blobPath)
{
var storageAccount = new CloudStorageAccount(new StorageCredentials(_storageAccountName, _storageAccountKey), true);
var cloudBlobClient = storageAccount.CreateCloudBlobClient();
var destContainer = cloudBlobClient.GetContainerReference(cloudBlobClient.BaseUri + _publishBlobContainer);
destContainer.CreateIfNotExists();
BlobContainerPermissions containerPermissions = new BlobContainerPermissions();
containerPermissions.PublicAccess = BlobContainerPublicAccessType.Blob;
destContainer.SetPermissions(containerPermissions);
var src = GetSasUrl(blobPath);
CloudBlockBlob srcBlob = new CloudBlockBlob(new Uri(src));
CloudBlockBlob destBlob;
destBlob = destContainer.GetBlockBlobReference(srcBlob.Name);
destBlob.StartCopyFromBlob(srcBlob);
return destBlob.StorageUri.PrimaryUri.ToString();
}
这就是抛出异常的地方:
destContainer.CreateIfNotExists();
更新: 当我调用上述方法时,Fiddler 会记录。
请求:
HEAD
https://accountname.blob.core.windows.net/https://accountname.blob.core.windows.net/published-clips?restype=container HTTP/1.1
User-Agent: WA-Storage/4.1.0 (.NET CLR 4.0.30319.34014; Win32NT 6.2.9200.0)
x-ms-version: 2014-02-14
x-ms-client-request-id: b60edc19-7d8f-4d6b-b264-0c98b9cb157d
x-ms-date: Thu, 26 Jun 2014 12:43:29 GMT
Authorization: SharedKey accountname:key
Host: accountname.blob.core.windows.net
Connection: Keep-Alive
回复:
HTTP/1.1 400 The requested URI does not represent any resource on the server.
Transfer-Encoding: chunked
Server: Microsoft-HTTPAPI/2.0
x-ms-request-id: 85015e32-fdcf-4398-af23-83ddf8a27c1b
Access-Control-Expose-Headers: x-ms-request-id
Access-Control-Allow-Origin: *
Date: Thu, 26 Jun 2014 12:43:31 GMT
【问题讨论】:
-
是否可以通过 Fiddler 跟踪请求/响应?这应该会为您提供有关此 400 错误的更多信息。
-
@GauravMantri 添加了 Fiddler 请求/响应,但并没有说太多。
标签: azure nuget azure-storage azure-blob-storage