Windows Azure Servicebus令牌提供程序无法提供令牌,但返回了空消息

时间:2012-03-22 14:31:04

标签: c# azure queue servicebus

尝试从Servicebus队列接收消息时,会抛出有关令牌提供程序的异常:

  

令牌提供商在访问&https://xyz-sb.accesscontrol.windows.net/WRAPv0.9/'时无法提供安全令牌。令牌提供商返回了消息:''。

仅当我的发行人和密钥正确时才会发生这种情况。如果它们不正确,令牌提供程序将返回描述错误的消息。我将代码添加到帖子中,直到它出错:

string user = ConfigurationManager.AppSettings["ServiceBusUser"];
string key = ConfigurationManager.AppSettings["ServiceBusSecret"];

TransportClientEndpointBehavior securityBehaviour = new TransportClientEndpointBehavior(TokenProvider.CreateSharedSecretTokenProvider(user, key));

Uri uri = ServiceBusEnvironment.CreateServiceUri("sb", "xyz", queue);
Uri deadUri = ServiceBusEnvironment.CreateServiceUri("sb", "xyz", queue + "/$DeadLetterQueue");

if (readDeadly && allIsWell)
{
    IChannelListener<IInputChannel> deadChannelListener = messagingBinding.BuildChannelListener<IInputChannel>(deadUri, securityBehaviour);
    deadChannelListener.Open();
    IInputChannel deadInputChannel = deadChannelListener.AcceptChannel();
    deadInputChannel.Open();

    while (readDeadly && allIsWell)
    {
        FlexilineLogger.Log(logpath, "readDeadly");
        try
        {
            try
            {
                queueMessage = deadInputChannel.Receive(TimeSpan.FromSeconds(10));

Exception发生在Receive。 这在昨天就像一个魅力,但今天它不断抛出异常。

有没有其他人遇到这个并且可能知道这个例外的原因? 或者是否有人有解决此问题的方法并希望分享?

谢谢。

1 个答案:

答案 0 :(得分:1)

http://blogs.msdn.com/b/piyushjo/archive/2011/09/27/azure-service-bus-working-with-the-appfabriclabs-account.aspx

似乎是答案,尽管我正试图弄清楚如何以工人角色来做这件事。

相关问题