2010-09-09 78 views
1

我正在将脚趾浸入Windows Azure中,并且我遇到了一些必须简单的事情,但我无法看到它。从Azure队列中删除消息时出现异常?

我有这个小测试与Azure的队列玩:

public void CanPublishSillyLittleMessageOnQueue() 
{ 
    var queueClient = CloudStorageAccount.DevelopmentStorageAccount.CreateCloudQueueClient(); 
    var testQueue = queueClient.GetQueueReference("testqueue1"); 

    testQueue.CreateIfNotExist(); 
    var message = new CloudQueueMessage("This is a test"); 
    testQueue.AddMessage(message); 

    CloudQueueMessage received; 

    int sleepCount = 0; 
    while((received = testQueue.GetMessage()) == null) 
    { 
     ++sleepCount; 
     Thread.Sleep(25); 
    } 
    testQueue.DeleteMessage(received); 

    Assert.Equal(message.AsString, received.AsString); 
} 

它发送消息就好了 - 我可以看到它在SQL表。然而,当它击中了“testQueue.DeleteMessage(收)”的方法,我得到这个:

TestCase 'AzureExploratory.PlayingWithQueues.CanPublishSillyLittleMessageOnQueue' 
failed: System.ArgumentNullException : Value cannot be null. 
Parameter name: str 
    at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result() 
    at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait() 
    at Microsoft.WindowsAzure.StorageClient.TaskImplHelper.ExecuteImplWithRetry(Func`1 impl, RetryPolicy policy) 
    at Microsoft.WindowsAzure.StorageClient.CloudQueue.DeleteMessage(CloudQueueMessage message) 
    PlayingWithQueues.cs(75,0): at AzureExploratory.PlayingWithQueues.CanPublishSillyLittleMessageOnQueue() 
这似乎是一个失败的Azure的SDK的胆量内某处

我使用的是VS 2010,.NET 4.0,Azure SDK V1.2,64位Win 7.开发者商店服务正在运行;我可以看到消息进入队列,我无法删除它们。

任何人都见过类似的东西吗?

回答

3

我想清楚发生了什么事。有问题的代码在xUnit测试工具中运行。事实证明,默认情况下,xUnit runner没有设置带有配置文件路径的appdomain。 System.UriBuilder现在碰到配置文件,所以它爆炸了。

解决方法是将一个空的app.config添加到测试项目。现在它可以工作。

ARGH!

+0

昨天xUnit团队修复了这个问题 - http://xunit.codeplex.com/Thread/View.aspx?ThreadId=226567 – 2010-09-11 22:50:43

相关问题