未处理的异常.RabbitMQ.客户例外情况.BrokerUnreachableException:无法访问任何指定的终



我已经使用这个docker映像在笔记本电脑上设置了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。客户例外情况。BrokerUnreachableException:没有可以访问指定的终结点--->RabbitMQ。客户例外情况。ConnectFailureException:连接失败--->系统网内部构件。SocketExceptionFactory+ExtendedSocketException(111(:连接被拒绝127.0.0.1:5672系统运行时。例外服务。ExceptionDispatchInfo。投掷(异常来源(。网插座。插座EndConnect(IAsyncResultasyncResult(系统网插座。插座<gt;c.b_275_0(IAsyncResult iar(---从引发异常的前一个位置开始的堆栈结尾跟踪--在RabbitMQ。客户TcpClientAdapter。ConnectAsync(字符串主机,Int32端口(RabbitMQ。客户Impl。TaskExtensions。TimeoutAfter(任务任务,Int32毫秒超时(RabbitMQ。客户Impl。SocketFrameHandler。ConnectOrFail(ITcpClient套接字,AmqpTcpEndpoint端点,Int32超时(---内部结束异常堆栈跟踪--在RabbitMQ。客户EndpointResolverExtensions。SelectOne[T](IEndpointResolver解析器、Func2 selector) at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.Init(IEndpointResolver endpoints) 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 RabbitMQ.Client.ConnectionFactory.CreateConnection(IList1主机名,字符串clientProviderName(RabbitMQ。客户ConnectionFactory。创建连接(IList1 hostnames) at RawRabbit.Channel.ChannelFactory.ConnectAsync(CancellationToken token) at RawRabbit.DependencyInjection.RawRabbitDependencyRegisterExtension.<>c.<AddRawRabbit>b__0_3(IDependencyResolver resolver) at RawRabbit.DependencyInjection.SimpleDependencyInjection.<>c__DisplayClass4_02.b_0((在系统中。Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.执行和发布(LazyHelperexecutionAndPublication,Boolean useDefaultConstructor(系统懒惰的1.CreateValue() at System.Lazy1.get_Value((RawRabbit。DependencyInjection。SimpleDependencyInjection<gt;c_DisplayClass4_02.<AddSingleton>b__1(IDependencyResolver resolver) at RawRabbit.DependencyInjection.SimpleDependencyInjection.GetService(Type serviceType, Object[] additional) at RawRabbit.DependencyInjection.SimpleDependencyInjection.GetService[TService](Object[] additional) at RawRabbit.Instantiation.InstanceFactory.Create() at iNRES.Common.RabbitMq.Extensions.AddRabbitMq(IServiceCollection services, IConfiguration configuration) at iNRES.Service.Common.Startup.ConfigureServices(IServiceCollection services) in /app/src/iNRES.Service.Common/Startup.cs:line 116 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection) at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder1。<gt;c_DisplayClass15_0.g_RunPipeline|0(IServiceCollection服务(微软AspNetCore。主机。配置ServicesBuilder。Invoke(对象实例,IServiceCollection服务(微软AspNetCore。主机。配置ServicesBuilder<gt;c__DisplayClass8_0.b_0(IServiceCollection服务(微软AspNetCore。主机。StartupLoader。配置服务电报生成器`1.<gt;c_DisplayClass14_0.g_ConfigureServicesWithContainerConfiguration |0(IServiceCollection服务(微软AspNetCore。主机。ConventionBasedStartup。ConfigureServices(IServiceCollection服务(微软AspNetCore。主机。WebHost。EnsureApplicationServices((位于微软AspNetCore。主机。WebHost。在初始化((微软AspNetCore。主机。WebHostBuilder。在生成((iNRES。服务水资源。程序中的Main(String[]args(/app/src/iNRES。服务Common/Program.cs:line 18

如果您在主机中运行客户端代码,则--hostnamedocker选项无效,因此您需要在客户端代码中使用localhost而不是rabbit-release

相关内容

最新更新