找不到字段:' RabbitMQ.Client.ConnectionFactory.VirtualHost'

时间:2015-01-26 16:10:47

标签: signalr rabbitmq easynetq

我尝试使用来自c#中队列使用者的SignalR.RabbitMQ(https://github.com/mdevilliers/SignalR.RabbitMq)使用RabbitMQ消息传递,代码如下:

RabbitMQ.Client.ConnectionFactory factory = new RabbitMQ.Client.ConnectionFactory();
factory.UserName= "username";
factory.Password="password";
factory.HostName="host.name.com";
factory.VirtualHost = "VirtualHost";
factory.Port = 5672;

var exchangeName = "SignalR.Messages";

var configuration = new RabbitMqScaleoutConfiguration(factory, exchangeName);
                            GlobalHost.DependencyResolver.UseRabbitMq(configuration);
var hubContext = GlobalHost.ConnectionManager.GetHubContext<Chat>();

但不幸的是,失败了:

var configuration = new RabbitMqScaleoutConfiguration(factory, exchangeName);

错误:

"Field not found: 'RabbitMQ.Client.ConnectionFactory.VirtualHost'."

相同的连接在控制台应用程序上正常工作。如果我删除VirtualHost仍然会出现相同的错误。

不知道出了什么问题。在此处发现相同的错误:https://github.com/MassTransit/MassTransit/issues/204但对我没有帮助。我使用EasyNetQ最新版本(0.40.3.353)和最新版本的RabbitMQ客户端(3.4.3)

1 个答案:

答案 0 :(得分:1)

使用旧版本的rabbitmq.client调用了适用于我的解决方案 install-package RabbitMQ.Client -version 3.1.5

希望这有助于某人