Azure Storage Emulator 400 Bad Request

人盡茶涼 提交于 2019-12-30 08:24:08

问题


I'm suddenly getting the Bad Request (400) error when using the Azure Storage Emulator when trying to CreateIfNotExists. The Response on the Inner Exception says "The value for one of the HTTP headers is not in the correct format." All the tables exist, the data is in the tables, everything was working up until an update to my NuGet packages. Looking around SO it seems like a common cause is an update to Azure Storage Client Library (now at 5.0.0) that creates a mismatch. I updated the Azure SDK to 2.6 (since I have VS2012). This brings the Storage Emulator up to 4.0.0.0, but still no luck...same error. This is kind of a bad thing that suddenly an update to a package of a package of a package causes the whole thing to break and completely kills my rather large project. Any ideas?


回答1:


In my case, the problem was with the Container Name, which has strict naming requirements.

Namely:

  • Only lowercase letters, numbers, and dash are allowed
  • Must be 3 to 63 characters

For more information, view Naming and Referencing Containers, Blobs, and Metadata on MSDN.




回答2:


I don't know if this is a problem for anyone else, but this is what I have figured out...

  • Storage Emulator 4.1.0.0 is the one to use with Azure Storage Client Library 5.0.0
  • Storage Emulator 4.1.0.0 comes with Azure SDK 2.7.
  • Azure SDK 2.7 will not work with Visual Studio 2012.
  • Azure SDK 2.6 for VS2012 has Emulator 4.0.0.0. I don't know what Storage Client Library is compatible... I tried 4.3.0.0, 5.0.0.0, and 5.0.2, but had no luck

.

My "philosophical" issues with this whole thing are...

  • I can find no discernible connection between Storage Emulator versions and Storage Client Library versions....The numbers don't "match"; there are no errors, dependencies, or exceptions that tell you the relationship; I can't find any look-up, cross-reference, or table that describes the proper combination of libraries.
  • The "just use the latest version" theory doesn't work because in the past they have released new versions of the Storage Client library (3.0.0.0) w/o a working Emulator and now the "latest version" of each is separately dependent on which SDK is available for your build environment (VS2012 vs VS2015)

I understand the Storage Client Library isn't technically "dependent" on the emulator...you don't need the emulator to use Azure Storage. However, it would just be nice if some of these relationships were a little easier for a software oaf like me to figure out.




回答3:


For me, I got this issue upon upgrading to the currently latest WindowsAzure.Storage version 9.3.1 package.

After hours of trying out various combinations of container names, and other stuff, the simplest solution was to roll back to the older and working version 8.6.0!




回答4:


If I am not mistaken, you would need to downgrade client libraries to 4.x as well.

You see, each version of storage client library corresponds to a storage service REST API version and same goes for storage emulator as well. If you use storage emulator version 4.0, then you can't use storage client library 5 with that. You would need to use version 4.x with that.

If you want to use storage client library version 5, then you have 2 options:

  1. Make use of latest version of storage emulator or
  2. Do your development against cloud storage account.


来源:https://stackoverflow.com/questions/32322029/azure-storage-emulator-400-bad-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!