2
votes

I am running in to the "400 bad request" error that many have posted about when accessing Azure blob storage. Most of the fixes relate to updating versions of the Azure SDK and of the Storage Emulator from late '13 or '14, but there have been several subsequent releases since then.

        CloudStorageAccount storageAccount = CloudStorageAccount.Parse("blabla");
        CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
        CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
        CloudBlockBlob blockBlob = container.GetBlockBlobReference(id);
        string x = blockBlob.DownloadText(); // <-- Problem happens here

I was running ok and then something changed to cause this error to start.

  • It does not appear to be a naming issue - my storage container is all lowercase and 12 characters
  • It's not the emulator - I'm not even using it

Running Visual Studio 2013 Community Edition, Azure SDK 2.6, and version 4.3.0 of the NuGet package for the Windows Azure Storage library. (I've tried going to the most recent 3.x release but same problem.)

In addition, to be sure I was clean, I removed all versions of the Azure SDK and of the local tools and reinstalled the Azure SDK 2.6.

1
Try tracing your request/response through Fiddler. You'll get more information about the error.Gaurav Mantri
@GauravMantri Great point. Fiddler showed http 400 "one of the request inputs is out of range". The container name is "mycontainer" so that should be ok. The id string was "abc123" so that is ok. Using the Azure Storage Explorer I deleted the blob and the container and recreated them with the same names, and the code executed without error. This problem will likely happened again as I didn't actually "solve" anything here. :) I did the "reboot" approach.Howiecamp

1 Answers