首页 技术 正文
技术 2022年11月12日
0 收藏 634 点赞 2,636 浏览 1357 个字

from:http://www.cnblogs.com/gossip/p/4573056.html

一、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的权限

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

未设置权限时:

rabbitmq坑点与异常处理

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

rabbitmq坑点与异常处理

二、异常:unable to connect to node rabbit@10: nodedown

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

三、异常: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= StackTrace

原因:队列服务端重启后,队列发布端断开了接口,无法再次发送消息

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

var factory = new ConnectionFactory();

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

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

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

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

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

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,960
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,484
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,330
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,113
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,745
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,779