没有指定的端点可以访问

时间:2015-09-07 06:02:02

标签: c# .net rabbitmq

在从.net应用程序发布消息时,rabbitmq中存在间歇性问题。它在系统中产生大量噪音。 我试过谷歌搜索,但找不到问题的根本原因。

以下是我在应用程序日志中可以看到的错误

None of the specified endpoints were reachable
Endpoints attempted:
------------------------------------------------
endpoint=amqp-0-9://localhost:5672, attempts=1
System.TimeoutException: Connection to amqp-0-9://localhost:5672 timed out
   at RabbitMQ.Client.Impl.SocketFrameHandler_0_9.Connect(TcpClient socket, AmqpTcpEndpoint endpoint, Int32 timeout)
   at RabbitMQ.Client.Impl.SocketFrameHandler_0_9..ctor(AmqpTcpEndpoint endpoint, ObtainSocket socketFactory, Int32 timeout)
   at RabbitMQ.Client.Framing.Impl.v0_9_1.ProtocolBase.CreateFrameHandler(AmqpTcpEndpoint endpoint, ObtainSocket socketFactory, Int32 timeout)
   at RabbitMQ.Client.ConnectionFactory.FollowRedirectChain(Int32 maxRedirects, IDictionary`2 connectionAttempts, IDictionary`2 connectionErrors, AmqpTcpEndpoint[]& mostRecentKnownHosts, AmqpTcpEndpoint endpoint)
================================================
Stack trace:
   at RabbitMQ.Client.ConnectionFactory.CreateConnection(Int32 maxRedirects)
   at RabbitMQ.Client.ConnectionFactory.CreateConnection()

1 个答案:

答案 0 :(得分:1)

我已经通过使RabbitMQ Connection对象单例来确保重用连接而不是每次都建立新连接来解决这个问题。