0
votes

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:

  • Connecting to Application logs ...

  • 2015-03-29T01:40:29 Welcome, you are now connected to log-streaming service.

  • Application: 2015-03-29T01:40:41 PID[1952] Error BEGIN

  • Application: 2015-03-29T01:40:44 PID[1952] Error Endpoint=sb://[removed-before-posting].servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=[removed-before-posting]

  • Application: 2015-03-29T01:41:48 PID[1952] Error The socket connection was aborted because an asynchronous send to the socket did not complete within the allotted timeout of 00:00:59.5586593. The time allotted to this operation may have been a portion of a longer timeout.

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.

1
So, when you reach the point of passing the connectionString parameter, the variable holding is populated with what you describe above? Can you share: 1) Where do you store the connectionString? 2) How do you read it and assign it to that variable?Panos
And also, how do you initialize the namespaceManager?Panos
Yes, at the point of passing the connection string parameter, the variable is holding the correct connection string, mentioned in my main post. 1. I am storing a connection string in web.config and 2) I am using CloudConnectionManager to get it.Zygimantas
var manager = NamespaceManager.CreateFromConnectionString(connectionString); if (!manager.QueueExists("Points")) { // removed } // no exceptions at this point.Zygimantas
I really can't see anything weird. Can you test with the sample provided -> azure.microsoft.com/en-us/documentation/articles/… and see if that works (create a new namespace etc.). At least we can narrow down if it's a code issue or an SB issue with the namespace.Panos

1 Answers

0
votes

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