gpt4 book ai didi

azure - Windows Azure 存储版本升级到 > 4 会导致 "The remote server returned an error: (400) Bad Request."

转载 作者:行者123 更新时间:2023-12-05 01:03:39 25 4
gpt4 key购买 nike

我在通过 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

最佳答案

请更改以下代码行:

var destContainer = cloudBlobClient.GetContainerReference(cloudBlobClient.BaseUri + _publishBlobContainer);

var destContainer = cloudBlobClient.GetContainerReference(_publishBlobContainer);

这应该可以解决问题。

关于azure - Windows Azure 存储版本升级到 > 4 会导致 "The remote server returned an error: (400) Bad Request.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24431131/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com