4
votes

I started experiencing this after an upgrade to 4.0.1.0 via nuget package manager. I then upgraded to 4.1.0.0 hoping it may be a bug, but still same issue.

I am using the Cloud-based azure storage, NOT the emulator.

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

This is the whole method (basically copying a 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 is throwing the exception:

destContainer.CreateIfNotExists();

UPDATE: Fiddler logs when I call the method above.

Request:

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

Response:

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
3
Is it possible to trace the request/response through Fiddler? That should give you more information about this 400 error.Gaurav Mantri
@GauravMantri Added Fiddler request/response, but it doesn't say much.Florin D. Preda

3 Answers

3
votes

Please change the following line of code:

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

to

var destContainer = cloudBlobClient.GetContainerReference(_publishBlobContainer);

That should fix the problem.

2
votes

There is no backward compatibility across major versions of the Storage Client Library. Note that each version is tied to a Storage Service REST version that could have changes in behavior (that's why we version both the service and client libraries). We recommend our customers to re-test their applications when upgrading to latest.

Thanks, Jean

0
votes

To add, for future reference, we follow semantic versioning scheme for our sdk documented at semver.org. You can use that as reference on what to expect for newer versions published.