EasyNetQ无法发布到RabbitMQ - PersistentChannel超时

woj*_*rak 11 rabbitmq cqrs easynetq

我正在尝试使用EasyNetQ连接到RabbitMQ.RabbitMQ在远程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));
Run Code Online (Sandbox Code Playgroud)

我得到一个TimeoutException The operation requested on PersistentChannel timed out..远程VM正在回复ping,端口5672和15672打开(使用nmap检查).可以从我的主机访问RabbitMQ管理.

另外,如果RabbitMQ在我的本地机器上运行,它可以正常工作.我尝试从局域网中的其他PC连接到我的计算机上安装的RabbitMQ,它也可以工作.

我假设它与虚拟机上的事实有关,也许连接有问题.但同样,Rabbit的网络管理工作正常.

也在EasyNetQ Test应用程序上测试 - 适用于localhost,但不适用于远程.

输出如下:

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
Run Code Online (Sandbox Code Playgroud)
  • EasyNetQ v0.28.4.242

小智 16

正如迈克建议我有这个,然后检查权限."guest"用户只能通过localhost连接(请参阅RabbitMQ访问控制.)尝试使用管理界面添加具有权限的用户,然后连接如下

var _bus = RabbitHutch.CreateBus(string.Format("host={0};virtualhost={1};username={2};password={3}", 
_hostSettings.Host, _hostSettings.VHost, _hostSettings.UserName, _hostSettings.Password));
Run Code Online (Sandbox Code Playgroud)


Mik*_*low 8

你检查了你的凭据吗?默认用户名和密码为"guest"和"guest".错误消息不是很有帮助.如果还存在身份验证错误,您将获得"无法访问任何指定的端点"