[英]Unable to Connect to Rabbit MQ
I am using amazon service and created rabbitmq broker now from the DOT.NET code i am trying to connect to this broker.我正在使用亚马逊服务,现在从 DOT.NET 代码创建了 rabbitmq 代理,我正在尝试连接到该代理。
var factory = new ConnectionFactory
{
Uri = new Uri("amqps://it:Password@hostname:5671")
};
var connection = factory.CreateConnection();
I am struggle here to get connection getting below error:我在这里努力让连接低于错误:
None of the specified endpoints were reachable
at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName)
Update:更新:
It seems your client wants to connect using TLS/SSL (your uri specifies the protocol "amqps" and the port 5671).您的客户端似乎想要使用 TLS/SSL 进行连接(您的 uri 指定协议“amqps”和端口 5671)。
Try enabling TLS/SSL:尝试启用 TLS/SSL:
var factory = new ConnectionFactory {
UserName = userName,
Password = password,
VirtualHost = "/",
HostName = hostName,
Port = port,
Ssl = new SslOption
{ Enabled = true, // <--------
ServerName = hostName }
};
The (JVM based) guide shows how to configure the connection factory. (基于 JVM 的) 指南展示了如何配置连接工厂。 It sets the credentials on the factory, not in the URI:
它在工厂而不是 URI 中设置凭据:
ConnectionFactory factory = new ConnectionFactory();
factory.setUsername(username); // <----------
factory.setPassword(password); // <----------
//Replace the URL with your information
factory.setHost("b-c8352341-ec91-4a78-ad9c-a43f23d325bb.mq.us-west-2.amazonaws.com");
factory.setPort(5671);
// Allows client to establish a connection over TLS
factory.useSslProtocol()
// Create a connection
Connection conn = factory.newConnection();
(This needs to be translated to the corresponding .NET code) (这个需要翻译成对应的.NET码)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.