I installed rabbitmq service on the server and on my system. I want to use RPC pattern:
var factory = new ConnectionFactory() {
HostName = "158.2.14.42",
Port = Protocols.DefaultProtocol.DefaultPort,
UserName = "Administrator",
Password = "@server@",
VirtualHost = "/"
ContinuationTimeout = new TimeSpan(10, 0, 0, 0)
};
connection = factory.CreateConnection();
I have an error on creating connection with this message:
None of the specified endpoints were reachable
When I use it on localhost instance of the server it works, but when I create the connection from local to that server,it returned the error. It not work with local ip and username and password of the my local computer.
Can anyone help me?
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.
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"
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With