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

30,783

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.

Share:
30,783
user1985899
Author by

user1985899

Updated on August 04, 2022

Comments

  • user1985899
    user1985899 almost 2 years

    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=

  • Jeremy Thompson
    Jeremy Thompson about 2 years
    We had to delete a bunch of Queues so if deleting the first one doesn't work and you get a similar error check whether its another Queue.