Azure Service Bus Sample "No connection could be made because the target machine actively refused it"
I'm trying to run the Azure Service Sample (MessagingWithQueue) which I downloaded from http://www.mi开发者_如何学Pythoncrosoft.com/download/en/details.aspx?id=17691.
However, I've been getting this error message:
Could not connect to net.tcp://xxxx.servicebus.windows.net:9354/. The connection attempt lasted for a time span of 00:00:00.0615234. TCP error code 10061: No connection could be made because the target machine actively refused it.
I'm running the application from within company network. Does service bus requires some firewall port to be opened?
Thank you.
The answer by Frank may have been correct, but today it's a little simple than that. If you can't get access to the AMQP port 5671 (because Security likes it tight) then you can tell the ServiceBusClient to use AMQP-over-WebSockets using port 443.
var sbcOptions = new ServiceBusClientOptions() { TransportType = ServiceBusTransportType.AmqpWebSockets };
var client = new ServiceBusClient(namespace, credential, sbcOptions);
https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-faq
The port 9354 need to be open for outbound connections on your firewall, if you plan to use Azure Service Bus messaging.
If you can't or don't want to open the port, consider using the REST instead. Here a post where I convert the lab to be RESTful: http://frankysnotes.com/2011/12/messaging-with-queue-in-azure-service.html
I hope this will help you.
精彩评论