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"
};
问题解决了!

浙公网安备 33010602011771号