问题描述
我正在尝试从wcf(4.5.2 .net framework)项目发布消息,如您所见:
public Int64 FindChargeByOrganization(string id) { var factory = new ConnectionFactory() { HostName = "localhost",UserName = "symfa",Password = "123qweQWE@" }; using (var connection = factory.CreateConnection()) using (var channel = connection.CreateModel()) { channel.QueueDeclare(queue: "symfa_queue",durable: false,exclusive: false,autoDelete: false,arguments: null); string message = "Hello World!"; var body = Encoding.UTF8.GetBytes(message); channel.Basicpublish(exchange: "",routingKey: "symfa_queue",basicProperties: null,body: body); } return 1; }
@H_502_5@RabbitMQ.Client.Exceptions.brokerUnreachableException: 'None of the specified endpoints were reachable' IOException: connection.start was never received,likely due to a network timeout This exception was originally thrown at this call stack: RabbitMQ.Client.Framing.Impl.Connection.StartAndTune() RabbitMQ.Client.Framing.Impl.Connection.Open(bool) RabbitMQ.Client.Framing.Impl.Connection.Connection(RabbitMQ.Client.IConnectionFactory,bool,RabbitMQ.Client.Impl.IFrameHandler,string) RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.Init(RabbitMQ.Client.Impl.IFrameHandler) RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.Init(RabbitMQ.Client.IEndpointResolver) RabbitMQ.Client.ConnectionFactory.CreateConnection(RabbitMQ.Client.IEndpointResolver,string)
@H_502_5@
但是,当我在带有netframework 4.5.2的控制台应用程序中调用此代码时,它会起作用。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)