NET客户端编程中发生异常“ AMQP操作被中断”(代码= 406) [英] Exception 'The AMQP operation was interrupted' (code=406) occurs in .NET Client programming

查看:2037
本文介绍了NET客户端编程中发生异常“ AMQP操作被中断”(代码= 406)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个2.8.2 RabbitMQ Server和一个2.8.2客户端dll,具有声明队列并获取消息的代码,它可以正常工作(所有参数都是正确的):

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);

但是当我下载3.0.1 RabbitMQ Server和3.0.1客户端dll时,我使用的是相同的代码,但有例外:

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:


AMQP操作被中断:AMQP关闭原因,由
对等方发起,代码= 406 ,text = PRECONDITION_FAILED-虚拟主机'/'中队列
'172.16.1.1'的参数不相等,classId = 50,methodId = 10,
原因=

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=


推荐答案

当您重新声明具有不同参数的现有队列时,通常会收到该错误消息。在管理控制台中检查队列是否已经存在。如果是这样,请尝试将其删除,然后重新运行您的代码。

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.

这篇关于NET客户端编程中发生异常“ AMQP操作被中断”(代码= 406)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆