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
未設置權限時:
設置權限:(點擊admin進入設置頁面)
二、異常: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