EasyNetQ fails to publish to RabbitMQ - PersistentChannel timed out
Asked Answered
L

2

12

I am trying to connect to RabbitMQ with EasyNetQ. RabbitMQ is on remote VM.

_rabbitBus = RabbitHutch.CreateBus(
    string.Format("host={0};virtualhost={1}", 
    _hostSettings.Host, _hostSettings.VHost),
     x => x.Register<IEasyNetQLogger>(l => _logger));

_rabbitBus.Subscribe<Message>(_topic, ReceiveMessage, m => m.WithTopic(_topic));

I get a TimeoutException The operation requested on PersistentChannel timed out.. Remote VM is replying to pings, ports 5672 and 15672 are opened (checked with nmap). RabbitMQ management can be accessed from my host.

Also, if RabbitMQ is run on my local machine, it works fine. I've tried connecting to RabbitMQ installed on my computer from other pc's in LAN, and it also works.

I've come to an assumption, that it's related to the fact it's on a virtual machine, and maybe there's something wrong in connection. But again, Rabbit's web management works fine.

Also tested on EasyNetQ Test application - works on localhost, but not on remote.

Output as following:

DEBUG: Trying to connect
ERROR: Failed to connect to Broker: '192.168.0.13', Port: 5672 VHost: '/'. 
       ExceptionMessage: 'None of the specified endpoints were reachable'
ERROR: Failed to connected to any Broker. Retrying in 5000 ms
  • EasyNetQ v0.28.4.242
Liv answered 5/4, 2014 at 14:43 Comment(0)
D
17

As Mike suggested i had this and then checked the permissions. "guest" user can only connect via localhost (see RabbitMQ Access Control.) Try adding a user with permissions using the management interface and then connect as below

var _bus = RabbitHutch.CreateBus(string.Format("host={0};virtualhost={1};username={2};password={3}", 
_hostSettings.Host, _hostSettings.VHost, _hostSettings.UserName, _hostSettings.Password));
Dugan answered 7/4, 2014 at 23:0 Comment(3)
This saved me, while having spent too much time investigating network issues due to that error messaeg. Thanks.Sniff
Thanks for this, I had spaces in my connection string causing the same error message!Kelso
Indeed, that error is totally misleading. The issue is the connection string with spaces.Blinding
B
8

Did you check your credentials. The default username and password is 'guest' and 'guest'. The error message is not very helpful. You get 'None of the specified endpoints were reachable' if there's an authentication error as well

Bawl answered 7/4, 2014 at 8:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.