尝试从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 回答
http://blogs.msdn.com/b/piyushjo/archive/2011/09/27/azure-service-bus-working-with-the-appfabriclabs-account.aspx
似乎是答案,尽管我正试图弄清楚如何在 Worker 角色中做到这一点 .