40104: Invalid Authorization Token Audience

Заблокировано 40104: Invalid Authorization Token Audience

  • lunedì 24 ottobre 2011 12:25
     
      Contiene codice

    Trying to do some basic "hello world" type functionality to post a message to a Service Bus queue, via WCF.

    I created a namespace fpr the Service Bus at portal.appfabriclabs.com and therefore have my namespace, issuer and key.I have not configured any other element (i.e. no Access Control, Cache or Applications).

    I've plugged credentials into both my own code and into sample code but cannot get this to work end to end.

    I'm using v1.5 of the Azure SDK in .Net 4.0 and Visual Studio 2010. I have a simple WCF service, with a console client app that creates a queue (if it doesn't already exist) and attempts to place an XmlDocument as a BrokeredMessage on a queue:

     

    var msg = new BrokeredMessage(myXmlDoc.OuterXml);
    

     

    Originally, I had the problem of the Service Point uri pointing to the production environment, but after reading this I added the following lines of code when my service and my client are first set up (I did it this way rather than via config as it is more visible, portable and can be wrapped within "#if debug ... #endif" statement.

     

    Environment.SetEnvironmentVariable("RELAYENV", "Custom");
    Environment.SetEnvironmentVariable("RELAYHOST", "servicebus.appfabriclabs.com");
    Environment.SetEnvironmentVariable("STSHOST", "accesscontrol.appfabriclabs.com");
    
    

     


    What I'm finding is that after the environemental variable changes, I am now able to connect. I am also able to successfully create and query queues. My problems begin when I invoke QueueClient.Send(...). As soon as I do this, the request fails with the following error from Microsoft.ServiceBus:

     

    40104: Invalid Authorization Token Audience

     


    Stack trace:

     

    Exception rethrown at [0]: 
       at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.OnEndSend(IAsyncResult result)
       at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.OnSend(TrackingContext trackingContext, IEnumerable`1 messages, TimeSpan timeout)
       at Microsoft.ServiceBus.Messaging.MessageSender.Send(TrackingContext trackingContext, IEnumerable`1 messages, TimeSpan timeout)
       at WCFServiceWebRole1.Service1.Queue(String value) in c:\##obfuscated##\Service1.svc.cs:line 113
       at WCFServiceWebRole1.Service1.PostToQueue(String value) in c:\##obfuscated##\WCFServiceWebRole1\Service1.svc.cs:line 26
       at SyncInvokePostToQueue(Object , Object[] , Object[] )
       at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)

     


    All I can think to check is my Issuer Key but that is definitely right and in any case, creation and query of queues works fine. Have a missed a newbie setup step with the AppFabricLabs environment? Why can I find no trace of this error anywhere online?!

    Please help!