I tried running following RabbitMQ tutorial. Its a simple program on their webpage, I ran on local desktop, and received error below. Does anyone know how to resolve issue?
Program:
class Send
{
public static void Main()
{
var factory = new ConnectionFactory() { HostName = "localhost" };
using(var connection = factory.CreateConnection())
using(var channel = connection.CreateModel())
{
channel.QueueDeclare(queue: "hello",
durable: false,
exclusive: false,
autoDelete: false,
arguments: null);
string message = "Hello World!";
var body = Encoding.UTF8.GetBytes(message);
channel.BasicPublish(exchange: "",
routingKey: "hello",
basicProperties: null,
body: body);
Console.WriteLine(" [x] Sent {0}", message);
}
Console.WriteLine(" Press [enter] to exit.");
Console.ReadLine();
}
}
Error:
RabbitMQ.Client.Exceptions.BrokerUnreachableException
HResult=0x80131620
Message=None of the specified endpoints were reachable
Source=RabbitMQ.Client
StackTrace:
at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName)
at ConsoleApp2.Program.Main(String[] args) in \Program.cs:line 13
Inner Exception 1:
AggregateException: One or more errors occurred.
Inner Exception 2:
ConnectFailureException: Connection failed
Inner Exception 3:
ExtendedSocketException: No connection could be made because the target machine actively refused it 127.0.0.1:5672
User contributions licensed under CC BY-SA 3.0