EasyNetQ 无法发布到 RabbitMQ - PersistentChannel 超时 [英] EasyNetQ fails to publish to RabbitMQ - PersistentChannel timed out

查看:37
本文介绍了EasyNetQ 无法发布到 RabbitMQ - PersistentChannel 超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 EasyNetQ 连接到 RabbitMQ.RabbitMQ 在远程虚拟机上.

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

我得到一个 TimeoutException PersistentChannel 上请求的操作超时..远程 VM 正在回复 ping,端口 5672 和 15672 已打开(使用 nmap 检查).可以从我的主机访问 RabbitMQ 管理.

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.

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

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.

我得出一个假设,它与它位于虚拟机上的事实有关,并且可能存在连接问题.但同样,Rabbit 的网络管理工作正常.

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.

还在 EasyNetQ 测试应用程序上进行了测试 - 可在本地主机上运行,​​但不能在远程上运行.

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

输出如下:

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
  • 推荐答案

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

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

    这篇关于EasyNetQ 无法发布到 RabbitMQ - PersistentChannel 超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆