Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure 400 Bad Request on every request

Tags:

c#

asp.net

azure

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!

like image 767
Knelis Avatar asked Nov 29 '13 11:11

Knelis


2 Answers

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.

like image 197
Gaurav Mantri Avatar answered Oct 21 '22 15:10

Gaurav Mantri


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

like image 1
Ognyan Dimitrov Avatar answered Oct 21 '22 14:10

Ognyan Dimitrov