rabbitmq_坑

 
1、None of the specified endpoints were reachable
这个异常在建立链接时抛出(CreateConnection()),缘由通常是ConnectionFactory参数设置不对,好比HostName、UserName、Password
标准设置:
var factory = new ConnectionFactory();
factory.UserName = QueueSetttiong.UserName;   //用户名
factory.Password = QueueSetttiong.Password;      //密码
factory.HostName = QueueSetttiong.HostName;   //Rabbitmq服务IP,不包含端口
factory.Port = AmqpTcpEndpoint.UseDefaultPort;
factory.VirtualHost = QueueSetttiong.VirtualHost;  //默认为 " / "
factory.Protocol = Protocols.DefaultProtocol;
 
部署生产后,factory配置都ok,可是仍是抛异常 None of the specified endpoints were reachable,最后发现缘由是生产机器防火墙未打开RabbitMQ的端口,RabbitMQ的默认端口是:5672



另一个可能的缘由:未设置VirtualHost的权限node

设置方法:RabbitmqWeb管理网站-->Admin网站

未设置权限时:spa

设置权限:(点击admin进入设置页面).net

 

 

 

 2、异常:unable to connect to node rabbit@10: nodedown日志

网上说要修改主机名,找半天不知道怎么修改,从新安装Rabbitmq服务端便可,有时候须要重启code

 

 3、异常:Message:Already closed: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=320, text="CONNECTION_FORCED - broker forced connection closure with reason 'shutdown'", classId=0, methodId=0, cause= StackTraceserver

缘由:队列服务端重启后,队列发布端断开了接口,没法再次发送消息blog

解决:发送端设置断开链接后自动启动属性,默认为断开后每隔五秒钟重试链接接口

 var factory = new ConnectionFactory();rabbitmq

factory.AutomaticRecoveryEnabled = true;   //设置端口后自动恢复链接属性便可

 

4、Rabbitmq实际数据文件、日志文件、配置文件路径

地址栏输入:%APPDATA%\RabbitMQ\

C:\Users\Administrator\AppData\Roaming\RabbitMQ

信息来源:C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.5.1\etc 中的README.txt

相关文章
相关标签/搜索