gpt4 book ai didi

c# - .NET Client编程出现异常 'The AMQP operation was interrupted' (code=406)

转载 作者:太空狗 更新时间:2023-10-29 18:08:28 26 4
gpt4 key购买 nike

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

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 时,我使用相同的代码并出现异常:

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=

最佳答案

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

关于c# - .NET Client编程出现异常 'The AMQP operation was interrupted' (code=406),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14410985/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com