RabbitMQ Connection Error " None of the specified endpoints were reachable"
I was also facing the same issue and later realized I have to open both ports i.e. 15672 and 5672.
The below command works for me in the docker container model.
docker run -it --rm --name mymq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
Code snippet:
var factory = new RabbitMQ.Client.ConnectionFactory
{
Uri = new Uri("amqp://guest:guest@localhost:5672/")
};
or
var factory = new ConnectionFactory() { HostName = "localhost" };
Do not use guest. Create your own account and password, and in http://localhost:15672/#/users , ensure "can access virtual hosts " is "/"
var factory = new ConnectionFactory() {
HostName = "192.168.1.121",
Port = 5672,
UserName = "fancky",
Password = "123456"
};
Thank you all.
As this :
https://stackoverflow.com/questions/4987438/rabbitmq-c-sharp-connection-trouble-when-using-a-username-and-password
After I installed RabbitMQ, I enabled management tools at the server and on my local computer with this:
rabbitmq-plugins enable rabbitmq_management
Then I restarted RabbitMQ service from services.msc
I could see the rabbitmq management at http://localhost:15672
I loginned to rabbit management with user:guest and pass:guest
I added my favorite user pass with administrator access, so it worked.
In our case it was an assembly binding failure of System.Threading.Tasks.Extensions
, our exception logger was not logging the InnerException
Exception information:
Exception type: FileLoadException
Exception message: Could not load file or assembly 'System.Threading.Channels, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection..ctor(ConnectionFactory factory, String clientProvidedName)
at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName) in /_/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs:line 494
Very poor misleading error message.