Exception 'The AMQP operation was interrupted' (code=406) occurs in .NET Client programming

橙三吉。 提交于 2019-12-22 04:30:34

问题


I have a 2.8.2 RabbitMQ Server and a 2.8.2 client dll, have the code to declare a queue and get a message, it works correctly (all parameters are correct):

IModel channel=null;

ConnectionFactory factory = new ConnectionFactory ();
factory.HostName = "192.168.68.4";
_QueueName = "172.16.1.1";

factory.UserName = "guest";
factory.Password = "guest";
factory.VirtualHost = "/";

factory.RequestedHeartbeat = 30;

if (factory.Endpoint == null) {
    Console.WriteLine (" factory.Endpoint==null ");
}


// 接受消息的队列名称是本地的IP地址
_QueueName = "172.16.1.1";
_RMQConnection = factory.CreateConnection ();

Console.WriteLine ("factory.CreateConnection()");

channel = _RMQConnection.CreateModel ();

channel.QueueDeclare(_QueueName, false, false,false,null);

But when I download 3.0.1 RabbitMQ Server and a 3.0.1 client dll, I use the same code and have the exception:

The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text="PRECONDITION_FAILED - parameters for queue '172.16.1.1' in vhost '/' not equivalent", classId=50, methodId=10, cause=


回答1:


You typically get that error message when you re-declare an existing queue with different parameters. Check in the management console to see if the queue already exists. If it does, try deleting it and then re-running your code.



来源:https://stackoverflow.com/questions/14410985/exception-the-amqp-operation-was-interrupted-code-406-occurs-in-net-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!