2

尝试从 Servicebus 队列接收消息时,会引发有关 Token Provider 的异常:

访问“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));

并且异常发生在接收。这昨天就像一个魅力,但今天它一直在上面抛出异常。

有没有其他人遇到过这个,也许知道这个异常的原因?或者有人有这个问题的解决方案并愿意分享吗?

谢谢你。

4

1 回答 1

1

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

似乎是答案,尽管我试图弄清楚如何以工人角色做到这一点。

于 2012-10-31T18:07:15.740 回答