当时无法将消息添加到多个Azure队列

时间:2013-05-01 20:00:36

标签: c# azure queue

经过5个小时的尝试后,我认为我的Azure帐户出现了问题,当时不让我使用多个队列。

我首先创建两个带有两个小写名称的队列,然后检查它们是否存在并检查它们的uri名称,看起来很好。

然后我开始向我的第一个队列添加一条消息,这很好,如果我检查队列有多少消息,它会给我一个大于0的数字。

然后我重复完全相同的步骤将消息添加到我的第二个队列,但这次当我尝试检查消息的数量时,它甚至不会说0,它会抛出空。

如果我从第二个队列使用getMessage(),它也会返回一条空消息,这意味着我添加的消息实际上都不会进入我的第二个队列中的存储。

这取决于帐户是否有任何限制?我是否必须在azure上设置不同的内容,以便我可以同时使用多个队列分区?

感谢您提前回复..

修改

WCF中我的班级最重要的定义为:

private static CloudQueue processedqueue;
private static CloudQueue notprocessedqueue;

这是我的InitializeStorage方法:

var queue1 = account.CreateCloudQueueClient();
                notprocessedqueue = queue1.GetQueueReference("notprocessedqueue");
                notprocessedqueue.CreateIfNotExist();
var queue2 = account.CreateCloudQueueClient();
                processedqueue = queue2.GetQueueReference("processedqueue");
                processedqueue.CreateIfNotExist();


//I have tried using queue1 to get the reference of both queues but is the same result

负责填补队列的方法:

   var message = new CloudQueueMessage(string.Format("{0},{1}", pWord, processed.ToString()));

    var message2 = new CloudQueueMessage(string.Format("{0},{1}", pWord, processed.ToString()));

processedqueue.AddMessage(message);
notprocessedqueue.AddMessage(message2);



processedqueue.Exists() <- Returns true
processedqueue.Uri.ToString() <- returns a proper URL with the name I defined in the getReference method
notprocessedqueue.Exists() <-  Retruns true 
notprocessedqueue.Uri.ToString() <- returns a proper URL with the name I defined in the getReference method

执行addMessage方法后,我尝试以下操作:

processedqueue.ApproximateMessageCount <- returns 1
notprocessedqueue.ApproximateMessageCount <- returns null

1 个答案:

答案 0 :(得分:0)

它最终起作用,我所做的是格式化我的解决方案存储在辅助角色中的虚拟硬盘,然后我点击了天蓝色管理门户中的“恢复到默认”,然后我重新启动计算机并重新启动部署了我的解决方案。

现在它的工作就像一个魅力,显然工人角色在某种程度上受到了骚扰。