此版本的存储模拟器不支持此请求的REST版本

Jho*_*uff 6 c# azure azure-storage

升级我的Azure Storage Explorer版本后,我的代码停止使用以下消息:

"此版本的存储模拟器不支持此请求的REST版本.请将存储模拟器升级到最新版本.有关详细信息,请参阅以下URL:http: //go.microsoft.com/fwlink/? LinkId = 392237 "

我的Azure Storage Explorer版本是0.8.16.

基本上,上传到azure的代码往往是:

CloudStorageAccount storageAccount = CloudStorageAccount.Parse("UseDevelopmentStorage=true");        
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer blobContainer = blobClient.GetContainerReference("mycontainer");
blobContainer.CreateIfNotExistsAsync();
CloudBlockBlob blockBlob = this.blobContainer.GetBlockBlobReference(fileName);
byte[] CoverImageBytes = null; 
BinaryReader reader = new BinaryReader(file.OpenReadStream()); 
CoverImageBytes = reader.ReadBytes((int)file.Length);
await blockBlob.UploadFromByteArrayAsync(CoverImageBytes, 0,(int)file.Length);
Run Code Online (Sandbox Code Playgroud)

异常抛出最后一行.

UPDATE

1)您正在运行的存储模拟器的版本是什么?

V5.1

2)在您的代码中,您正在使用的Storage Client库的版本是什么?

这里是8.4.0

Gau*_*tri 5

您收到此错误的原因是Storage Client Library 8.4的目标是REST API版本2017-04-17,其中Storage Emulator V5.1以REST API版本为目标2016-05-31.

你可以做以下两件事之一:

  1. 安装最新版本的Storage Emulator(此时为5.2).
  2. 将存储客户端库降级到8.3,支持REST API版本2016-05-31.

我的建议是使用#1即使用最新版本的存储模拟器.