为什么我的azure存储帐户中的队列域丢失了?

Pau*_*nto 6 c# azure azure-storage-queues

我已使用以下设置在Azure上成功创建了一个存储帐户:

  • 部署:资源管理器
  • 类型:通用(标准)
  • 复制:ZRS

在Azure门户网站上,我可以看到"Blobs"服务,如果点击它,我可以在blob域下创建blob容器:https:// [account_name] .blob.core.windows.net /

到现在为止还挺好.

当我尝试在C#应用程序中使用Azure SDK创建队列时,我收到错误,它无法找到[account_name]的域.队列 .core.windows.net.

我一直在关注创建存储帐户的Microsoft教程并使一个简单的队列工作,我看不到创建这个"队列"域的任何其他步骤.在Azure门户本身,我找不到任何其他选项来创建队列或队列服务.

我用来参考的代码:

var storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ToString());

var blobClient = storageAccount.CreateCloudBlobClient();
var blobContainer = blobClient.GetContainerReference("export");
blobContainer.CreateIfNotExists();

var queueClient = storageAccount.CreateCloudQueueClient();
var exportQueue = queueClient.GetQueueReference("export-requests");
exportQueue.CreateIfNotExists();
Run Code Online (Sandbox Code Playgroud)

创建blob容器的调用成功,我可以在Azure门户中看到新容器.创建队列的调用失败,但出现以下异常:

An exception of type 'Microsoft.WindowsAzure.Storage.StorageException' occurred in Microsoft.WindowsAzure.Storage.dll but was not handled in user code

Additional information: The remote name could not be resolved: '[account_name].queue.core.windows.net'
Run Code Online (Sandbox Code Playgroud)

Gau*_*tri 13

您收到此错误的原因是因为ZRS存储帐户仅支持Blob存储(并且仅支持Blob存储).从这篇博客文章:https://blogs.msdn.microsoft.com/windowsazurestorage/2014/08/01/introducing-zone-redundant-storage/(参见章节Using a ZRS account)

由于ZRS帐户不支持页面blob,文件,表或队列,因此在ZRS存储帐户上创建或操作这些对象的任何尝试都将失败.

如果要使用队列,则需要选择其他冗余级别.此时,以下类型的存储帐户冗余级别支持队列 - LRS,GRS和RAGRS.目前,无法将ZRS帐户更改为LRS/GRS/RAGRS帐户.因此,您需要创建一个新的存储帐户.