我试图简单地使用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/