None of the specified endpoints were reachable


我連接RabbitMQ的代碼如下:

                var connectionFactory = new ConnectionFactory()
                {
                    HostName = "192.168.1.5",
                    Port = 15672,
                    UserName = "guest",
                    Password = "gues",
                    VirtualHost = "/"
                };

  

出現的問題如下:

RabbitMQ.Client.Exceptions.BrokerUnreachableException
HResult=0x80131620
Message=None of the specified endpoints were reachable
Source=RabbitMQ.Client
StackTrace:
在 RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName)
在 RabbitMQ.Client.ConnectionFactory.CreateConnection(String clientProvidedName)
在 RabbitMQ.Client.ConnectionFactory.CreateConnection()
在 SJ.RabbitMQConsoleTest.Normal.RabbitMQConnection.SendMessage()

 

 

解決方案:

去官網(http://rabbitmq.mr-ping.com/tutorials_with_csharp/HelloWorld.html)查,按照官網的去操作就可以解決了;

把代碼改為:

var connectionFactory = new ConnectionFactory()
{
HostName = "localhost"
};

 

問題解決了!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM