Again, it supposed to be simple, but wasn't able to find any documentation about it
In my previous question I had a problems with running rabbitmq container in docker. It has been solved, but now another one appeared
Container was created with this line
docker run -d --hostname my-rabbit --name some-rabbit -p 15672:15672 rabbitmq:3-management
I was trying to create a simple console application to check how message sending is working (from base tutorial):
var factory = new ConnectionFactory()
{
HostName = "localhost",
Port = 15672
};
using (var connection = factory.CreateConnection())
{
using (var channel = connection.CreateModel())
{
channel.QueueDeclare("Test", false, false, false, null);
var mess = new RepMessage()
{
ConnectionString = "TestingString",
QueueID = 5
};
var jsonified = JsonConvert.SerializeObject(mess);
var messBody = Encoding.UTF8.GetBytes(jsonified);
channel.BasicPublish("", "Test", null, messBody);
Console.WriteLine(string.Format("Message with ConStr={0}, QueueID={1} has been send", mess.ConnectionString, mess.QueueID));
}
}
And result is, its not working.
I am receiving exception None of the specified endpoints were reachable
and inner exception as connection.start was never received, likely due to a network timeout
If I remove port, then my inner exception transforms in No connection could be made because the target machine actively refused it 127.0.0.1:5672
What am I missing, is is this example not supposed to work with docker?