我在这里不知所措,所以我向集体知识伸出援手,希望奇迹发生。
我已经使用默认值在Linux上安装了RabbitMQ。
当我使用这段代码(以及默认的RabbitMQ安装配置)时,一切都很好。
var connectionFactory = new ConnectionFactory();
connectionFactory.HostName = "192.168.0.12";
IConnection connection = connectionFactory.CreateConnection();
但是,当我将用户添加到RabbitMQ并尝试使用以下代码时(用户名和密码已更改以保护无辜者。:))
var connectionFactory = new ConnectionFactory();
connectionFactory.HostName = "192.168.0.12";
connectionFactory.UserName = "user";
connectionFactory.Password = "password";
IConnection connection = connectionFactory.CreateConnection();
connectionFactory.CreateConnection()
方法抛出以下异常:
BrokerUnreachableException
None of the specified endpoints were reachable
检查RabbitMQ日志文件,我可以看到它抱怨凭据:
{amqp_error,access_refused,
"PLAIN login refused: user user - invalid credentials",
connection.start_ok }}
问题是,我对用户名和密码很有信心,因为热爱编码,我无法在任何地方找到解决方案。
I must be missing something obvious but I can t figure out what it is. I would be grateful for any helpful pointers.