RabbitMQ BrokerUnreachableException (.net 4.8 vs .NET 8.0) (doesn't work/works)

154 Views Asked by At

I am trying to connect to a localhost RabbitMQ server on my machine and keep getting the error.

Error:

RabbitMQ.Client.Exceptions.BrokerUnreachableException: 'None of the specified endpoints were reachable. IOException: connection.start was never received, likely due to a network timeout '

RabbitMQ Logs:

Below are the rabbitMQ logs for the event. It appears the client just closes the connection.

2023-11-13 10:29:23.589000-06:00 [info] <0.1615.0> accepting AMQP connection <0.1615.0> ([::1]:64128 -> [::1]:5672) 2023-11-13 10:29:23.606000-06:00 [warning] <0.1615.0> closing AMQP connection <0.1615.0> ([::1]:64128 -> [::1]:5672): 2023-11-13 10:29:23.606000-06:00 [warning] <0.1615.0> client unexpectedly closed TCP connection

As soon as my .net 4.8 console app reaches the CreateConnection point the above error is thrown.

private static void Main(string[] args)
{
    string queueName = "EPLAN:JobProcessing";
    var factory = new ConnectionFactory
    {
        HostName = "localhost",
        UserName = "guest",
        Password = "guest"
    };
    using (var connection = factory.CreateConnection()) //Errors out here
    {
        using (var channel = connection.CreateModel())
        {
        
        }    
    }
}

However, in my .NET 8.0 project, it connects just fine and is able to communicate (with essentially the same exact code). I am able to view the RabbitMQ management ui in http://localhost:15672/ so I know everything there works.

What I have tried:

  • Reinstalling RabbitMQ.Client on .NET 4.8 project.
  • Tried restarting the RabbitMQ service in services.msc
  • Tried using a new account instead of guest and gave it Admin, policymaker, and management tags.

Versions:

  • RabbitMQ.Client version 6.6.0
  • Console App (.Net 4.8)
  • Web API (.Net 8.0)

Overall I see no real reason it should work on .NET 8.0 but it does not on my .NET 4.8 project? Could anyone point me in the right direction here?

0

There are 0 best solutions below