我是RabbitMQ新手。
我尝试从tutorial那里运行示例代码:
代码:
path('some/', CreateSomeView.as_view(), name="create-some-details"),
path('some/<int:pk>/', SomeView.as_view(), name="some-details"),
我在vs 2019中运行代码 在这一行:
class Receive
{
public static void Main()
{
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);
var consumer = new EventingBasicConsumer(channel);
consumer.Received += (model, ea) =>
{
var body = ea.Body;
var message = Encoding.UTF8.GetString(body);
Console.WriteLine(" [x] Received {0}", message);
};
channel.BasicConsume(queue: "hello",
autoAck: true,
consumer: consumer);
Console.WriteLine(" Press [enter] to exit.");
Console.ReadLine();
}
}
}
我得到一个错误:
using(var connection = factory.CreateConnection())
试图更改为其他端口:
RabbitMQ.Client.Exceptions.BrokerUnreachableException: 'None of the specified endpoints were reachable'
ExtendedSocketException: No connection could be made because the target machine actively refused it. 127.0.0.1:5672
关闭防火墙,并仍然收到相同的异常
谢谢