Azure - 创建队列保持返回 "(400) bad request"

标签 azure azure-storage azure-queues

我试图简单地使用Azure创建一个新的存储队列,但它一直崩溃而没有解释,创建表工作得很好,这是相关的代码:

        private CloudTable userTable;
        private CloudTable petTable;
        private CloudQueue healingQueue;

        public override bool OnStart()
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("connectionString"));
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
            userTable = tableClient.GetTableReference("users");
            userTable.CreateIfNotExists();
            petTable = tableClient.GetTableReference("pets");
            petTable.CreateIfNotExists();

            // This is where I create the queue: //
            CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
            healingQueue = queueClient.GetQueueReference("healQueue");
            healingQueue.CreateIfNotExists(); // This line makes the code crash.
        }

代码在healingQueue.CreateIfNotExists();行崩溃,并解释了(400)错误请求

表创建得很好,所以我认为存储帐户没有问题,我能做什么?

最佳答案

问题出在以下代码行:

healingQueue = queueClient.GetQueueReference("healQueue");

您收到此错误的根本原因是您为队列选择了无效名称。尝试使用 healqueue (全部小写)。

请参阅此链接了解队列命名规则:https://msdn.microsoft.com/en-us/library/azure/dd179349.aspx .

关于Azure - 创建队列保持返回 "(400) bad request",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34825981/

相关文章:

c# - 在 C# WPF 桌面应用程序中将 MSAL 与身份验证上下文结合使用

powershell - Azure PowerShell Connect-AzureAD 和登录-AzureRmAccount

azure - 使用 AAD 和 Azure Function 的 Easy Auth 隐式流程返回未经授权

c# - 从 Azure 应用服务访问 Blob 存储

c# - 最大 CloudQueueMessage 负载大小问题

Azure队列-将超时消息返回到队列的头部

python - 获取 Azure VMSS 中实例的公共(public) IP?

unit-testing - 在单元测试中模拟 azure blob 存储

azure - 在家学习 Windows Azure?

c# - Azure函数: how to implement delay of retrying queue message better