Azure Website connection with remote name Queue ServiceBus could not be resolved

I have a simple Azure website (PaaS website) that is trying to connect to a Service Bus queue. However, it gets the error:

[WebException: Remote name cannot be resolved: '']
System.Net.HttpWebRequest.GetRequestStream (TransportContext & context) +6543605 System.Net.HttpWebRequest.GetRequestStream () +13 Microsoft.ServerStream .TokenProviderHelper.GetAccessTokenCore (Uri requestUri, String applyTo, String requestToken, String simpleAuthAssertionFormat, TimeSpan timeout, String & expires, String & Audience) +617

Any ideas on how to fix this error? It looks like a permissions issue, but I'm new to Azure and I can't see how to fix it. It uses the "RootManageSharedAccessKey" Service Bus, which has the Manage, Send, and Listen permissions.

I also have a worker role that can access the queue, so I know there is a queue there. I can also use Visual Studio to send a test message to the queue and the worker gets it. I just can't get the front azure access site to access it.


source to share

2 answers

I have changed the way I connect to Service Bus. The problem was related to not passing the correct values ​​to the NamespaceManager. I used the following to connect to Service Bus:

    // By default when connecting to the queue we will look at the appSettings for they key "Microsoft.ServiceBus.ConnectionString"
    //  <appSettings>
    //    <add key="Microsoft.ServiceBus.ConnectionString" value="Endpoint=sb://;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=XXXXXXXXXXXXXXXXXXXXXXXXXXX" />
    //  </appSettings>
    public TachyonQueueClient(String queueName, String appSettingKey = "Microsoft.ServiceBus.ConnectionString")
        name = queueName;

        string connectionString = CloudConfigurationManager.GetSetting(appSettingKey);
        namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
        if (!namespaceManager.QueueExists(queueName))

        // Initialize the connection to Service Bus Queue
        client = QueueClient.CreateFromConnectionString(connectionString, queueName);




Have you recently created a new Service Bus namespace from the azure portal? Changes have been made where the default authentication mechanism is SAS and no ACS namespaces are automatically created.

Please refer to this blog for details on this issue authentication-mechanism-for-service-bus-namespaces-now-sas.aspx



All Articles