Search code examples
c#asp.netwindowsnetwork-programmingrabbitmq

RabbitMQ - How to connect RabbitMQ which is installed on other server (PC)


I want to connect RabbitMQ server which is installed on our other host machine [IP - 192.168.0.115]. and it runs locally on "localhost:15672" and i am trying to connect using my C# code.

This is my code to connect RabbitMQ from my local machine which is also connected in a same intranet environment.

                var factory = new ConnectionFactory
                {
                    HostName = "192.168.0.115",
                    UserName = "guest",         
                    Password = "guest",        
                    Port = 15672,                     
                                                       
                };

by using this code i am getting an exception of "Server not reachable". if there is any server setting or firewall setting. please guide me for this issue.


Solution

  • I believe the problem is in the port used.

    The port you are using, 15672, is the default port for the rabbitmq management console.

    For publisher or consumer connections, the default port is port 5672, using the AMQP protocol.

    There may be some blocking between the servers. To test this, you can use the following command: telnet 192.168.0.115 5672

    There is a topic explaining about RabbitMQ ports: What ports does RabbitMQ use?