Upgrading Windows Azure Storage version to 4 reasons "The remote server responded with an error: (400)" Bad request. "

I started testing this after upgrading to 4.0.1.0 through the nuget package manager. Then I upgraded to 4.1.0.0, hoping that this might be a bug, but still the same problem.

I use azure cloud storage, not an emulator.

I previously used 3.0.3.0, and it worked, and still works when I switch to this version.

This is the whole method (basically copying blob from one container to another)

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();
    }

And this is where the exception is thrown:

destContainer.CreateIfNotExists();

UPDATE: Fiddler log when I call the method above.

Inquiry:

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

Answer:

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
+4
source share
3

:

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

var destContainer = cloudBlobClient.GetContainerReference(_publishBlobContainer);

.

+3

. , REST , ( , ). .

,

+2

, , sdk, semver.org. , .

0
source

Source: https://habr.com/ru/post/1546138/


All Articles