Error while trying to connect to another Rabbitmq server

Asked

Viewed 248 times

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}");
        }
    }

2 answers

1

I found the solution to my problem. It was necessary to change the door.

   Port = AmqpTcpEndpoint.UseDefaultPort,

Then my connection code got that way:

        var factory = new ConnectionFactory()
    {
        HostName = "[ip da máquina aqui]",
        Port = AmqpTcpEndpoint.UseDefaultPort,
        UserName = "meu usuario",
        Password = "minha senha"
    };

0

The problem occurs of the confusion between the doors used by Rabbitmq. The messaging service correctly at the door 5672. However, the admin plugin runs on the port 15672.

Described in the questionnaire, the tests were done by the web interface, which then accesses the administrative panel on the port 15672.

The port that applications should use to connect to Rabbitmq is the 5672.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.