我在iis上托管asp.net core 2.0 webapi应用程序。但是在托管我的应用程序之后,rabbitmq托管Broker无法访问。我已经用vs调试模式测试了它,并且工作正常。所以我的uri是正确的。 这是我的代码。
services.AddSingleton(provider => Bus.Factory.CreateUsingRabbitMq(cfg =>
{
var host = cfg.Host(new Uri("rabbitmq://192.168.100.239:15672/"), "/", h =>
{
h.Username("vinit");
h.Password("vinit");
h.Heartbeat(10);
});
cfg.ReceiveEndpoint(host, "TestQ", e =>
{
e.LoadFrom(provider);
});
}));
在iis中,我收到此错误。
Microsoft.AspNetCore.Hosting.Internal.HostedServiceExecutor[9]
An error occurred starting the application
System.AggregateException: One or more errors occurred. (Broker unreachable: vinit@192.168.100.239:15672/) ---> MassTransit.RabbitMqTransport.RabbitMqConnectionException: Broker unreachable: vinit@192.168.100.239:15672/ ---> RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable ---> System.IO.IOException: connection.start was never received, likely due to a network timeout
at RabbitMQ.Client.Framing.Impl.Connection.StartAndTune()
at RabbitMQ.Client.Framing.Impl.Connection.Open(Boolean insist)
at RabbitMQ.Client.Framing.Impl.ProtocolBase.CreateConnection(IConnectionFactory factory, Boolean insist, IFrameHandler frameHandler, String clientProvidedName)
at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName)
--- End of inner exception stack trace ---
at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName)
at MassTransit.RabbitMqTransport.Integration.ConnectionContextFactory.<CreateConnection>d__9.MoveNext()
--- End of inner exception stack trace ---
at MassTransit.RabbitMqTransport.Integration.ConnectionContextFactory.<CreateConnection>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
我是否缺少某些东西或需要进行其他设置?
请建议我。 谢谢
答案 0 :(得分:0)
阅读RabbitMQ文档后,我得到了答案,我们可以从系统中的Rabbitmq.config文件管理端口,并且有不同的端口可以传输。
谢谢