MassTransit请求回复样本

时间:2018-06-05 10:54:50

标签: rabbitmq masstransit

我正在学习MassTransit,所以我下载了他们所拥有的sample,但它似乎并没有为我工作,我尝试时遇到以下错误启动服务:

An exception occurred
MassTransit.RabbitMqTransport.RabbitMqConnectionException: Connect failed: igor@localhost:5672/test ---> RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable ---> RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=530, text="NOT_ALLOWED - vhost test not found", classId=10, methodId=40, cause=
   at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)

当我尝试使用旧版本的MassTransit使用其他示例时,它们工作正常。

1 个答案:

答案 0 :(得分:2)

该示例使用RMQ URI,其中包含test虚拟主机。由于您尚未创建它,因此您的代码会失败,它实际上会告诉您 - 虚拟主机test未找到。

以下是该示例中的app.config

<appSettings>
    <add key="RabbitMQHost" value="rabbitmq://localhost/test"/>
    <add key="ServiceQueueName" value="request_service"/>
</appSettings>

因此客户uses the same URI,所以它们都将无法启动。