通过 hostname/ip 连接到 RabbitMQ(使用 NServiceBus)
Connecting to RabbitMQ via hostname/ip (using NServiceBus)
我正在使用 NServiceBus (5.x) 和 RabbitMQ (3.6) 作为传输。此连接字符串有效:
<connectionStrings>
<add name="NServiceBus/Transport"
connectionString="host=localhost;username=****;password=***;RequestedHeartbeat=600;"/>
</connectionStrings>
但是在同一台服务器上(安装了 RabbitMQ 服务器的地方),使用主机名或 IP 不起作用:
<connectionStrings>
<add name="NServiceBus/Transport"
connectionString="host=myServerPC;username=****;password=***;RequestedHeartbeat=600;"/>
</connectionStrings>
我收到这个错误:
2016-04-04 14:37:45.370 ERROR NServiceBus.Transports.RabbitMQ.RabbitMqConnectionManager Failed to connect to Broker: 'myServerPC', Port: 5672 VHost: '/'. ExceptionMessage: 'None of the specified endpoints were reachable'
我尝试了以下方法:
- 创建了我自己的管理员用户(不是来宾)并通过登录 RabbitMQ Management UI 对其进行了验证。也可以在远程机器上工作。全部使用 myServerPC。
- 使用 Service Insight -> 注册为 NServicebus 安装许可证。
谢谢!
这很可能是因为您的 RabbitMq 实例仅侦听 localhost
。检查 RABBITMQ_NODE_IP_ADDRESS
的配置,它应该为空或还包含您的主机外部 ip 地址。如果是127.0.0.1
或者localhost
,就只能用你的loopback地址去连接RabbitMq了。
我正在使用 NServiceBus (5.x) 和 RabbitMQ (3.6) 作为传输。此连接字符串有效:
<connectionStrings>
<add name="NServiceBus/Transport"
connectionString="host=localhost;username=****;password=***;RequestedHeartbeat=600;"/>
</connectionStrings>
但是在同一台服务器上(安装了 RabbitMQ 服务器的地方),使用主机名或 IP 不起作用:
<connectionStrings>
<add name="NServiceBus/Transport"
connectionString="host=myServerPC;username=****;password=***;RequestedHeartbeat=600;"/>
</connectionStrings>
我收到这个错误:
2016-04-04 14:37:45.370 ERROR NServiceBus.Transports.RabbitMQ.RabbitMqConnectionManager Failed to connect to Broker: 'myServerPC', Port: 5672 VHost: '/'. ExceptionMessage: 'None of the specified endpoints were reachable'
我尝试了以下方法:
- 创建了我自己的管理员用户(不是来宾)并通过登录 RabbitMQ Management UI 对其进行了验证。也可以在远程机器上工作。全部使用 myServerPC。
- 使用 Service Insight -> 注册为 NServicebus 安装许可证。
谢谢!
这很可能是因为您的 RabbitMq 实例仅侦听 localhost
。检查 RABBITMQ_NODE_IP_ADDRESS
的配置,它应该为空或还包含您的主机外部 ip 地址。如果是127.0.0.1
或者localhost
,就只能用你的loopback地址去连接RabbitMq了。