Azure 400 Bad Request on every request

10,846

Solution 1

Did you by any chance install the latest version of Storage Client library (3.0.0.0) which was released yesterday? That could be one reason why your code stopped working because the latest version of library doesn't work with storage emulator (Scroll down to the bottom of this post: http://blogs.msdn.com/b/windowsazurestorage/archive/2013/11/27/windows-azure-storage-release-introducing-cors-json-minute-metrics-and-more.aspx). If you look at the detailed error message, you will see One of the request headers is invalid.

UPDATE: 03-Feb-2014

Please download Storage Emulator 2.2.1 Preview which has support for latest storage client library. More information about this release can be found here: http://blogs.msdn.com/b/windowsazurestorage/archive/2014/01/27/windows-azure-storage-emulator-2-2-1-preview-release-with-support-for-2013-08-15-version.aspx.

UPDATE: 15-Apr-2014

If you're using SDK Version 2.3, then there's no need for installing Storage Emulator 2.2.1. Storage Emulator in version 2.3 fully supports Storage client library 3.x.

Solution 2

I had the same problem with Azure Storage Emulator 3.0.0 which came from Azure SDK 2.3 on VS 2013 update 2.

To solve the problem I started the Web Platform Installer and searched for Storage Emulator then ran the Azure SDK 2.3 (VS2013) and it installed Storage Emulator 3.2.0.0 which fixes the problem.

enter image description here

Share:
10,846
Knelis
Author by

Knelis

Updated on July 24, 2022

Comments

  • Knelis
    Knelis almost 2 years

    For some reason my DevStorage account has stopped working. I get a 400 Bad Request error on every request to DevStorage (both Blob and Table). I can browse DevStorage with Azure Storage Explorer, though.

    This is really strange, because I'm not aware of changing anything to the environment.

    I have re-installed Azure SDK 2.1 (July 2013). Even after a clean install, it does not work. When I deploy the cloud service to Windows Azure, it works fine. Running it in the emulator doesn't.

    I actually use the same code as the samples to connect, but I'll post it anyway.

    // Storage account
    var storageAccount = CloudStorageAccount.Parse(
            CloudConfigurationManager.GetSetting("StorageConnectionString"));
    
    // Blob client
    var blobClient = storageAccount.CreateCloudBlobClient();
    
    // Container
    var cloudContainer = blobClient.GetContainerReference(container);
    cloudContainer.CreateIfNotExists();
    
    • Value of StorageConnectionString is UseDevelopmentStorage=true.
    • Container is lowercase, letters only (e.g. 'pictures').
    • I run Visual Studio 2012 as administrator.

    Any help would be much appreciated!

  • Knelis
    Knelis over 10 years
    Looks like I did! Reverting back to 2.1.0.4 fixed the problem. Thanks!
  • Phil Cooper
    Phil Cooper over 10 years
    Same fix here. It appears I only have to look at the nuget packages around azure and they update to a version not supported by the emulator and/or cloud :(
  • Ian Robertson
    Ian Robertson over 10 years
    I have set up a brand new project, installed 2.1.0.4 using SDK 2.2 and I get the bad request 400 message whether I am pointing at the Emulator or a real Storage Account! What is going on!
  • Gaurav Mantri
    Gaurav Mantri over 10 years
    @IanDangerRobertson May I suggest posting this as a separate question. There could be many other reasons why you would get 400 error. Please include the code as well.
  • BenjiFB
    BenjiFB over 10 years
    Does anyone know if there is still no compatibility between the storage emulator and the latest version of the Storage Client Library? I'm trying to use V3.0.2 and I get a 400 error when I call container.CreateIfNotExists()
  • Gaurav Mantri
    Gaurav Mantri over 10 years
    Please download Storage Emulator 2.2.1 Preview which has support for latest storage client library. More information about this release can be found here: blogs.msdn.com/b/windowsazurestorage/archive/2014/01/27/….
  • krisdyson
    krisdyson over 10 years
    Thanks for this solution. This has cost me an hour. I do wonder about MS sometimes.
  • tofutim
    tofutim about 10 years
    Does anyone know if this is still necessary with Azure SDK 2.3?
  • Gaurav Mantri
    Gaurav Mantri about 10 years
    No it is not. SDK 2.3 has full compatibility with storage client library version 3.x.
  • digaomatias
    digaomatias almost 10 years
    Man, this was pulling my hair off!!! You saved my day. I was having the same issue, and it worked after installing SDK 2.3.