none
ServiceBus Queue: error code 10061: No connection could be made because the target machine actively refused

    Question

  • I'm working with a sample "https://www.windowsazure.com/en-us/develop/net/how-to-guides/service-bus-queues/"

    The Queue is created and deleted from a code without error. But on the  Client.Receive() or Client.Send(new BrokeredMessage()); I'm getting an error:

    Unhandled Exception: Microsoft.ServiceBus.Messaging.MessagingCommunicationExcept
    ion: Could not connect to net.tcp://...-samples-servicebus.servicebus.windows.ne
    t:9354/. The connection attempt lasted for a time span of 00:00:01.0011001. TCP
    error code 10061: No connection could be made because the target machine actively refused it 168.62.16.180:9354.  ---> System.ServiceModel.EndpointNotFoundExcep
    tion: Could not connect to net.tcp://...-samples-servicebus.servicebus.windows.n
    et:9354/. The connection attempt lasted for a time span of 00:00:01.0011001. TCP
     error code 10061: No connection could be made because the target machine active
    ly refused it 168.62.16.180:9354.  ---> System.Net.Sockets.SocketException: No c
    onnection could be made because the target machine actively refused it 168.62.16
    .180:9354
       at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
       at System.ServiceModel.Channels.SocketConnectionInitiator.ConnectAsyncResult.
    OnConnect(IAsyncResult result)
       --- End of inner exception stack trace ---

    Server stack trace:
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.CommunicationObject.EndOpen(IAsyncResult resu
    lt)...


    Leonid Ganeline [BizTalk MVP] BizTalkien: Naming Conventions for the BizTalk Solutions

    Monday, July 23, 2012 11:30 PM

Answers

  • It looks as your firewall is blocking outbound traffic on port 9354.

    In order to validate this, write a simple program which tries to connect to your namespace. Something like:

    using System.Net;

    TcpClient client = new TcpClient();
    client.Connect("fqdn", 9454);  <-- fqdn should point to Your Service Bus NameSpace URI

    If that is the case, and you can't open your firewall to outbound traffic, Try using Service Bus with HTTPs:

    ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http;

    Regards,

    Ziv. Windows Azure Service Bus team.

    Wednesday, July 25, 2012 12:30 AM
  • Hi Leonid,

    Does the http mode work now?

    There are three possible mode values:

    • ConnectivityMode.Tcp: All one-way and event listeners create independent connections through port 828 (SSL) or port 808.

    • ConnectivityMode.Http: This is the alternate HTTP polling mode discussed above.

    • ConnectivityMode.AutoDetect: This is the default mode. This mode automatically selects between the Tcp and Http modes based on an auto-detection mechanism that probes whether either connectivity option is available for the current network environment and prefers Tcp.

    Thanks

    Leo Lin

    Friday, July 27, 2012 5:11 AM

All replies

  • Hi,

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay.
     
    Appreciate your patience.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    Tuesday, July 24, 2012 7:53 AM
  • It looks as your firewall is blocking outbound traffic on port 9354.

    In order to validate this, write a simple program which tries to connect to your namespace. Something like:

    using System.Net;

    TcpClient client = new TcpClient();
    client.Connect("fqdn", 9454);  <-- fqdn should point to Your Service Bus NameSpace URI

    If that is the case, and you can't open your firewall to outbound traffic, Try using Service Bus with HTTPs:

    ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http;

    Regards,

    Ziv. Windows Azure Service Bus team.

    Wednesday, July 25, 2012 12:30 AM
  • Arwind, zivraf: 

    Thank you!

    It was the Firewall (on my VM and on my host machine).

    I could not set up the ConnectivityMode.Http (it is in my schedule) :)

    Thanks a lot!


    Leonid Ganeline [BizTalk MVP] BizTalkien: Naming Conventions for the BizTalk Solutions

    Wednesday, July 25, 2012 2:15 AM
  • Hi Leonid,

    Does the http mode work now?

    There are three possible mode values:

    • ConnectivityMode.Tcp: All one-way and event listeners create independent connections through port 828 (SSL) or port 808.

    • ConnectivityMode.Http: This is the alternate HTTP polling mode discussed above.

    • ConnectivityMode.AutoDetect: This is the default mode. This mode automatically selects between the Tcp and Http modes based on an auto-detection mechanism that probes whether either connectivity option is available for the current network environment and prefers Tcp.

    By default, all service endpoints listening for messages using one of these two bindings will connect up to the  Service Bus fabric using outbound TCP port 828 (for SSL-protected connections) or outbound TCP port 808.

    If neither of these ports is available for outbound communication, the Mode of the connectivity settings can be set to ConnectivityMode.Http, which enables the HTTP polling mode that communicates only through outbound ports 80 and 443 using RFC 2616-compliant HTTP requests. RFC 2616 strongly recommends constraining the concurrent requests to a particular domain to be limited to two, and the operating system and networking devices or upstream proxies can enforce that limit, the HTTP polling mode is using a single HTTP connection to implement polling. All messages destined for all one-way and event endpoints in the current application domain are multiplexed through the HTTP polling connection and distributed locally.

    Thanks

    Leo Lin

    Friday, July 27, 2012 5:10 AM
  • Hi Leonid,

    Does the http mode work now?

    There are three possible mode values:

    • ConnectivityMode.Tcp: All one-way and event listeners create independent connections through port 828 (SSL) or port 808.

    • ConnectivityMode.Http: This is the alternate HTTP polling mode discussed above.

    • ConnectivityMode.AutoDetect: This is the default mode. This mode automatically selects between the Tcp and Http modes based on an auto-detection mechanism that probes whether either connectivity option is available for the current network environment and prefers Tcp.

    Thanks

    Leo Lin

    Friday, July 27, 2012 5:11 AM
  • Interesting.

    First, I've set up the Firewall and it starts working.

    Today it was not working again. I had tried everything with firewall without luck.

    Then the ConnectivityMode. It works only if the 

       

                ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http;

    is before the creation of the queue

    ...               QueueDescription qd = new QueueDescription(queueName);
                    namespaceManager.CreateQueue(qd);

    It is not obvious for the entry level users as me :)

    So now it works with  ConnectivityMode.Http.

    Thank you for help!

    I was impressed by the help on this forum. Thank you guys a lot!


    Leonid Ganeline [BizTalk MVP] BizTalkien: Naming Conventions for the BizTalk Solutions

    Friday, July 27, 2012 5:51 AM