Reputation: 21
When trying to receive a message from a Servicebus queue, an exception gets thrown about the Token Provider:
The token provider was unable to provide a security token while accessing 'https://xyz-sb.accesscontrol.windows.net/WRAPv0.9/'. Token provider returned message: ''.
This only happens when my issuer and key are correct. When they are incorrect, the token provider returns a message describing what was wrong. I'll add the code to the post until where it goes wrong:
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));
And the Exception occurs at the Receive. This worked yesterday like a charm, but today it keeps throwing the exception above.
Has anyone else encountered this and perhaps knows the reason for this exception? Or does someone have a solution for this problem and would like to share it?
Thank you.
Upvotes: 2
Views: 4273
Reputation: 733
seems to be the answer, though I'm trying to figure out how to do this in a worker role.
Upvotes: 1