微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

c# – 为什么我的azure存储帐户上的队列域丢失了?

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

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

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

到现在为止还挺好.

当我尝试在C#应用程序中使用Azure SDK创建队列时,我收到错误,它无法找到[account_name] .queue.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();

创建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'

解决方法

您收到此错误的原因是因为ZRS存储帐户仅支持Blob存储(并且仅支持Blob存储).来自此博文: https://blogs.msdn.microsoft.com/windowsazurestorage/2014/08/01/introducing-zone-redundant-storage/(请参阅使用ZRS帐户一节)

Since ZRS accounts do not support page blob,file,table or queue,any
attempt to create or manipulate those objects on a ZRS storage account
will fail.

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

原文地址:https://www.jb51.cc/csharp/98697.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐