1
I am trying to send a message to another machine in my network that already has the rabbitmq installed.
The following error occurs:
Error message: None of the specified endpoints Were Reachable
When accessing this machine via web browser works properly. So I know that the problem is not in my network nor in Rabbit mq
Below the code I’m using
static void Main(string[] args)
{
var factory = new ConnectionFactory()
{
HostName = "[ip da máquina aqui]",
Port = 15672,
UserName = "meu usuario",
Password = "minha senha"
};
try
{
using (var conexao = factory.CreateConnection())
{
using (var canal = conexao.CreateModel())
{
canal.QueueDeclare(queue: "hello", durable: false, exclusive: false, autoDelete: false, arguments: null);
string mensagem = args[0];
var corpo = Encoding.UTF8.GetBytes(mensagem);
canal.BasicPublish(exchange: "", routingKey: "hello", basicProperties: null, body: corpo);
Console.WriteLine("[x] Sent {0}", mensagem);
}
}
Console.WriteLine("Pressione [enter] tecla para sair");
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine($"Messagem de erro: {ex.Message}");
}
}