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

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

问题描述

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

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 The operation requested on PersistentChannel timed out.. 远程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在我的本地计算机上运行,​​则可以正常工作. 我尝试从局域网中的其他PC连接到安装在计算机上的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 Test应用程序上进行了测试-在localhost上有效,但不能在远程上使用.

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所建议的那样,然后检查了权限. 来宾"用户只能通过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天全站免登陆