Zygimantas
Zygimantas

Reputation: 8827

Accessing Azure Service Bus Queue from Azure Website

I can't access Azure Service Bus Queue from Azure Website once deployed to the cloud. While running on localhost, if works fine, I can send a message to the queue, but if I deploy the application, on the remote server I am getting an exception while creating QueueClient:

"The socket connection was aborted because an asynchronous send to the socket did not complete within the allotted timeout of 00:00:59.4820817. The time allotted to this operation may have been a portion of a longer timeout."

I am using QueueClient.CreateFromConnectionString(connectionString) method. The debugger shows that everything is fine with the connectionString variable.

The connection string is:

Endpoint=sb://[removed].servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=[removed]

I have tried to set "Copy Local = True" to all references without success. I am using WindowsAzure.ServiceBus 2.6.4 nuget.

Also, the exception is not raised on NamespaceManager.QueueExists(name) if the queue exists, but exception is raised on NamespaceManager.CreateQueue(name) if it does not exist.

Anyone has experienced such problem? Thanks in advance for any tips.

UPDATE 1:

For clarification, I am providing the block of code and the trace output:

System.Diagnostics.Trace.TraceError("BEGIN");
var queueClient = QueueClient.CreateFromConnectionString(this.configuration.ServiceBusConnectionString, "points");
System.Diagnostics.Trace.TraceError(this.configuration.ServiceBusConnectionString);
queueClient.Send(new BrokeredMessage());   
System.Diagnostics.Trace.TraceError("END");

Produces the output:

UPDATE 2

There are no connectivity issues while using Azure Storage API or SQL server.

UPDATE 3

Both, website instance and service bus namespace are created in North Europe region.

Upvotes: 0

Views: 635

Answers (1)

Eccountable
Eccountable

Reputation: 642

I have not been able to get the connection strings (that are available in the Azure UI) for Queues to work either, but I found that when I use a Powershell command

Get-AzureSBNamespace -Name $servicebusNamespace

to get the connection string, it comes up with a completely different connection string that actually works. So now I use the following code to provision all my Service Bus Queues: createServiceBusQueue.ps1

Upvotes: 0

Related Questions