我已经在我的笔记本电脑上设置了RabbitMQ服务器,使用这个码头映像。
https://hub.docker.com/_/rabbitmq
和命令:docker run -d --hostname rabbit-release --name rabbit-releaset -p 15672:15672 -p 5672:5672 rabbitmq:3-management
和背景:
"rabbitMq": {
"namespace": "common",
"retries": 3,
"retryInterval": 2,
"username": "guest",
"password": "guest",
"virtualHost": "/",
"port": 5672,
"hostnames": [
"rabbit-release"
],
"requestTimeout": "00:00:10",
"publishConfirmTimeout": "00:00:01",
"recoveryInterval": "00:00:10",
"persistentDeliveryMode": true,
"autoCloseConnection": true,
"automaticRecovery": true,
"topologyRecovery": true,
"exchange": {
"durable": true,
"autoDelete": false,
"type": "Topic"
},
"queue": {
"autoDelete": false,
"durable": true,
"exclusive": false
}
},这是已退出的容器的日志:
未处理异常。RabbitMQ.Client.Exceptions.BrokerUnreachableException:没有一个指定的端点是可到达的--> RabbitMQ.Client.Exceptions.ConnectFailureException:连接失败--> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (111):连接拒绝了127.0.0.1:5672 (在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception源)在System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult(在System.Net.Sockets.Socket.<>c.b__275_0(IAsyncResult iar) )--堆栈跟踪的结束。抛出异常的位置--在RabbitMQ.Client.TcpClientAdapter.ConnectAsync(String主机上,( RabbitMQ.Client.Impl.TaskExtensions.TimeoutAfter(Task任务,Int32 millisecondsTimeout)在RabbitMQ.Client.Impl.SocketFrameHandler.ConnectOrFail(ITcpClient套接字,AmqpTcpEndpoint端点,Int32超时)-内部异常堆栈跟踪-在RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.Init(IEndpointResolver端点的RabbitMQ.Client.EndpointResolverExtensions.SelectOneT -在RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver,String clientProvidedName) -内部异常堆栈跟踪的结束- RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver,( RabbitMQ.Client.ConnectionFactory.CreateConnection(IList
1 hostnames, String clientProvidedName) at RabbitMQ.Client.ConnectionFactory.CreateConnection(IList1主机名)(在RawRabbit.Channel.ChannelFactory.ConnectAsync(CancellationToken令牌)(在RawRabbit.DependencyInjection.RawRabbitDependencyRegisterExtension.<>c.b0_3(IDependencyResolver解析器)在RawRabbit.DependencyInjection.SimpleDependencyInjection.<>cDisplayClass4_02.b\_\_0() at System.Lazy1.ViaFactory(LazyThreadSafetyMode模式下)在System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.1.CreateValue(在System.Lazy1.get\_Value() at RawRabbit.DependencyInjection.SimpleDependencyInjection.<>c\_\_DisplayClass4\_02.b1(IDependencyResolver解析器)在RawRabbit.DependencyInjection.SimpleDependencyInjection.GetService(Type serviceType ),( RawRabbit.DependencyInjection.SimpleDependencyInjection.GetServiceTService at RawRabbit.Instantiation.InstanceFactory.Create() at iNRES.Common.RabbitMq.Extensions.AddRabbitMq(IServiceCollection services,IConfiguration configuration) at iNRES.Service.Common.Startup.ConfigureServices(IServiceCollection服务) in /app/src/iNRES.Service.Common/Startup.cs:在System.RuntimeMethodHandle.InvokeMethod(Object目标处的第116行,Object[]参数,签名sig,布尔构造函数,布尔wrapExceptions)在System.Reflection.RuntimeMethodInfo.Invoke(Object obj,BindingFlags invokeAttr,binder粘合剂,Object[]参数,)在Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object实例中,( Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>cDisplayClass9_0.g__Startup|0(IServiceCollection serviceCollection)在Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder1.<>c\_\_DisplayClass15\_0.g\_\_RunPipeline|0(IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c\_\_DisplayClass8\_0.b\_\_0(IServiceCollection services) at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder1.<>c__DisplayClass14_0.g__ConfigureServicesWithContainerConfiguration|0(IServiceCollection服务( IServiceCollection服务)在Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection服务( Microsoft.AspNetCore.Hosting.WebHost.EnsureApplicationServices() at Microsoft.AspNetCore.Hosting.WebHost.Initialize() at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at iNRES ).Service.WaterResource.Program.Main(String[] args)在/app/src/iNRES.Service.public/Program.cs:第18行
发布于 2020-08-05 07:18:37
如果在主机中运行客户端代码,则--hostname停靠器选项没有任何效果,因此您需要在客户端代码中使用localhost而不是rabbit-release。
https://stackoverflow.com/questions/63257499
复制相似问题