在按照他們網站上的教程到下面是我的代碼之后,我無法連接到 rabbitMQ 服務器。var factory = new ConnectionFactory() { HostName = "localhost" }; using(var connection = factory.CreateConnection()) using(var channel = connection.CreateModel()) { channel.QueueDeclare(queue: "hello", durable: false, exclusive: false, autoDelete: false, arguments: null); string message = "Hello World!"; var body = Encoding.UTF8.GetBytes(message); channel.BasicPublish(exchange: "", routingKey: "hello", basicProperties: null, body: body); Console.WriteLine(" [x] Sent {0}", message); } Console.WriteLine(" Press [enter] to exit."); Console.ReadLine();
1 回答

慕蓋茨4494581
TA貢獻1850條經驗 獲得超11個贊
BrokerUnreachableException
表示客戶端無法訪問服務器。
檢查服務器是否實際啟動并運行,或者您是否有一些防火墻配置。
有幾篇關于的帖子BrokerUnreachableException
,例如關注這個關于那個的帖子
- 1 回答
- 0 關注
- 318 瀏覽
添加回答
舉報
0/150
提交
取消