Closed Riyas8880 closed 6 years ago
Hi, @Riyas8880 - this exception occurs if the RabbitMQ broker isn't reachable. This can occur for several reasons. Looking closer at your stack trace, it looks like the DNS name can not be resolved
System.Net.Sockets.SocketException: No such host is known
at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
at System.Net.Dns.ResolveCallback(Object context)
As far as I can tell, it is not related to RawRabbit. If you want to use a more elaborate error strategy consider using the Polly enricher
Hi,
I have faced the following issue occasionally while start the application even though RabbitMQ server is running fine.
var rawRabbitClient = RawRabbitFactory.CreateSingleton(new RawRabbitOptions { ClientConfiguration = new RawRabbitConfiguration { Username = "guest", Password = "guest", VirtualHost = "/", Port = 5672, Hostnames = new List { hostName }
Exception
RabbitMQ.Client.Exceptions.BrokerUnreachableException HResult=0x80131620 Message=None of the specified endpoints were reachable Source=RabbitMQ.Client StackTrace: at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName) at RawRabbit.Channel.ChannelFactory.ConnectAsync(CancellationToken token) at RawRabbit.DependencyInjection.RawRabbitDependencyRegisterExtension.<>c.b0_3(IDependencyResolver resolver)
at RawRabbit.DependencyInjection.SimpleDependencyInjection.<>c__DisplayClass4_0`2.b 0()
at System.Lazy
1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy
1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy`1.CreateValue() at RawRabbit.DependencyInjection.SimpleDependencyInjection.GetService(Type serviceType, Object[] additional) at RawRabbit.DependencyInjection.SimpleDependencyInjection.GetService[TService](Object[] additional) at RawRabbit.Instantiation.InstanceFactory.Create() at RawRabbit.Instantiation.RawRabbitFactory.CreateSingleton(RawRabbitOptions options)Inner Exception 1: ConnectFailureException: Connection failed
Inner Exception 2: SocketException: No such host is known
{RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable ---> RabbitMQ.Client.Exceptions.ConnectFailureException: Connection failed ---> System.Net.Sockets.SocketException: No such host is known at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6) at System.Net.Dns.ResolveCallback(Object context) --- End of stack trace from previous location where exception was thrown --- at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult) at System.Net.Dns.EndGetHostAddresses(IAsyncResult asyncResult) at System.Net.Dns.<>c.b25_1(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactoryd2.MoveNext()
at RabbitMQ.Client.Impl.TaskExtensions.d 1.MoveNext()
at RabbitMQ.Client.Impl.SocketFrameHandler.ConnectOrFail(ITcpClient socket, AmqpTcpEndpoint endpoint, Int32 timeout)
--- End of inner exception stack trace ---
at RabbitMQ.Client.EndpointResolverExtensions.SelectOne[T](IEndpointResolver resolver, Func`2 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 RawRabbit.Channel.ChannelFactory.ConnectAsync(CancellationToken token)
at RawRabbit.DependencyInjection.RawRabbitDependencyRegisterExtension.<>c.b__0_3(IDependencyResolver resolver)
at RawRabbit.DependencyInjection.SimpleDependencyInjection.<>c DisplayClass4_0
1.FromAsyncCoreLogic(IAsyncResult iar, Func
2 endFunction, Action1 endAction, Task
1 promise, Boolean requiresSynchronization) --- End of stack trace from previous location where exception was thrown --- at RabbitMQ.Client.TcpClientAdapter.2.<AddSingleton>b__0() at System.Lazy
1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy
1.CreateValue() at RawRabbit.DependencyInjection.SimpleDependencyInjection.GetService(Type serviceType, Object[] additional) at RawRabbit.DependencyInjection.SimpleDependencyInjection.GetService[TService](Object[] additional) at RawRabbit.Instantiation.InstanceFactory.Create() at RawRabbit.Instantiation.RawRabbitFactory.CreateSingleton(RawRabbitOptions options)Thanks, L.Riyas Ahamed