gpt4 book ai didi

rabbitmq - factory.CreateConnection() 生成一个 None of the specified endpoints were reachable;

转载 作者:行者123 更新时间:2023-12-05 04:48:33 26 4
gpt4 key购买 nike

我们在 IIS 8 下运行的 ASP.NET Web 应用程序中有一个简单的 RabbitMQ .NET 客户端。我们不使用任何 SSL,连接代码也很简单。

var factory = new ConnectionFactory()
{
HostName = hostname,
UserName = username,
Password = password,
VirtualHost = vhost,
Port = 5672
};

var connection = factory.CreateConnection();

最后一行产生如下异常

Exception Occurred
Type: RabbitMQ.Client.Exceptions.BrokerUnreachableException
Message: None of the specified endpoints were reachable
Stack Trace: at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName) in /_/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs:line 505
at Org.Prod.Dependency.Concrete.Queuing.RabbitMqProdMessenger.SendMessage[TMessage](String hostname, String username, String password, String vhost, String target, TMessage message, Boolean targetIsExchange)
Source: RabbitMQ.Client

Inner Exception

Type: System.IO.IOException
Message: connection.start was never received, likely due to a network timeout
Stack Trace: at RabbitMQ.Client.Framing.Impl.Connection.StartAndTune() in /_/projects/RabbitMQ.Client/client/impl/Connection.cs:line 1074
at RabbitMQ.Client.Framing.Impl.Connection.Open(Boolean insist) in /_/projects/RabbitMQ.Client/client/impl/Connection.cs:line 707
at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.Init(IFrameHandler fh) in /_/projects/RabbitMQ.Client/client/impl/AutorecoveringConnection.cs:line 646
at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName) in /_/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs:line 495
Source: RabbitMQ.Client

有趣的是,当将相同的代码放入控制台应用程序并将二进制文件发送到运行该应用程序的同一服务器时,控制台应用程序可以正常连接并能够发布消息。

Web 应用程序尝试执行与控制台应用程序相同的操作有什么问题?

最佳答案

这是 System.Threading.Tasks.Extensions 的程序集绑定(bind)失败,我们的异常记录器没有记录 InnerException

Exception information: 
Exception type: FileLoadException
Exception message: Could not load file or assembly 'System.Threading.Channels, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection..ctor(ConnectionFactory factory, String clientProvidedName)
at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName) in /_/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs:line 494

非常糟糕的误导性错误消息。

关于rabbitmq - factory.CreateConnection() 生成一个 None of the specified endpoints were reachable;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68011963/

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