.NET Azure SDK - Blob 请求返回 400 BadRequest

标签 .net azure azure-blob-storage

我正在使用今天发布的最新 Azure SDK Nuget 包 3.0,并尝试在我的开发环境中本地使用 Blob 存储。我使用 Azure 存储资源管理器在本地开发存储中创建了一个 blob,并尝试读取数据,但返回了 400 错误请求。当我深入研究异常返回的响应对象时,它显示“HTTP header 之一的值格式不正确。”

奇怪的是,当我在浏览器中输入完整的 URL 时,它会正常下载 blob ( http://xxx.x.x.x:10000/devstoreaccount1/test/722b6bea-d609-48e0-a4af-3ed0f5160ad9 )

这是我正在使用的代码:

        var storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse("UseDevelopmentStorage=true");
        var blobClient = storageAccount.CreateCloudBlobClient();
        var container = blobClient.GetContainerReference("test");

        var blob = container.GetBlockBlobReference("722b6bea-d609-48e0-a4af-3ed0f5160ad9");
        var text = blob.DownloadText();

我还尝试在代码中创建一个新的 blob,但遇到了相同的异常

最佳答案

这篇文章可能会对您有所帮助:

http://social.msdn.microsoft.com/Forums/windowsazure/en-US/b1b66cc0-5143-41fb-b92e-b03d017ea3c1/400-bad-request-connecting-to-development-storage-using-azure-storage-client-ver-20?forum=windowsazuredata

更新

正如 Gaurav Mantri 在评论中指出的:

Don't use Storage Client library 3.0 as it makes use of latest storage service version which is not yet supported in storage emulator. Based on the blog post by storage team, support for latest storage service version in emulator is coming in couple of months.

关于.NET Azure SDK - Blob 请求返回 400 BadRequest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20258352/

相关文章:

c# - (C# 7.2) "private protected"修饰符的用例是什么?

c# - Log4net 停止使用自定义渲染器

azure - 为什么 Azure 中的企业应用程序下禁用新注册?

c# - 将数据从 Azure Excel blob 文件导入到 SQL Server

c# - 无法加载文件或程序集...但一开始没有?

.net - ObservableCollection-无法实现,因为它没有匹配的返回类型

c# - 找不到用于部署到 Azure Web 服务的已发布 DLL

azure - 在 Azure 中的私有(private)存储帐户下创建容器

azure - 是否可以从 Azure Blob 存储中从末尾读取文本文件?

python - 没有名为 'azure.storage.blob.sharedaccesssignature' 的模块