Windows Azure Storage 3.0.1.0与Azure Storage Emulator 2.2.0.0兼容问题

来源:互联网 发布:工商数据采集工具 编辑:程序博客网 时间:2024/06/08 02:04

       两天前,在Visual Studio 2013上通过NuGet安装了 Windows Azure Storage 3.0.1.0 客户端类库,该版本是12月份刚刚更新的,如下图所示。 但是在调用 CreateIfNotExists() 通过本地的 Windows Storage Emulator 2.2.0.0 创建Windows Azure Table时,总是抛出异常 : A first chance exception of type 'Microsoft.WindowsAzure.Storage.StorageException' occurred in Microsoft.WindowsAzure.Storage.dll. Additional Information : The remote server returned an error : (400) Bad Request。所使用创建代码非常简单:

// Creates Changeset table if not existsvar client = StorageAccount.CreateCloudTableClient();table = client.GetTableReference(tableName);table.CreateIfNotExists();


不应该是Windows Azure Storage APIs使用的问题。进一步检查给出的异常信息,发现其Response.StatusCode = BadRequest; Response.StatusDescription = The value for one of the HTTP headers is not in the correct format。在网上搜索了一下,已经有人报过类似的问题,但原因也是多种,比如:Table名字中包含非法字符的等。

       此外,也有人提到有可能是Azure Storage API和Emulator不兼容的问题,于是将正在使用的Windows Azure Storage由3.0.1.0降到一个月前的版本 2.1.0.4,在安装了2.1.0.4后,同样的代码运行一切正常。看来确实是 Windows Azure Storage 3.0.1.0 和 Windows Azure Storage Enumlator 2.2.0.0 的兼容问题,解决的办法就是将Storage类库降级到较早的版本。不仅是3.0.1.0,在我的环境中Windows Azure Storage 3.0.0 也有类似与Storage Emulator的兼容的问题。





0 0
原创粉丝点击