我正在使用今天发布的最新 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,但遇到了相同的异常
最佳答案
这篇文章可能会对您有所帮助:
更新
正如 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/