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