Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
522 views
in Technique[技术] by (71.8m points)

c# - Azure 400 Bad Request on every request

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...