I have a windows forms application that is built on .NET 4.6.2. I'm connecting the app to rabbitmq using below code. Rabbit mq services are deployed on a separate server.
var factory = new ConnectionFactory() { HostName = _host, Port = _port, UserName = _userName, Password = _password };
if (_port != 5672){
factory.Ssl.Enabled = true;
factory.Ssl.Version = System.Security.Authentication.SslProtocols.Tls12;
factory.Ssl.CertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };}
Client = factory.CreateConnection();
Channel = Client.CreateModel();
This is working completely fine in production. Now recently we were planning a new release where there were changes in other components but no changes in this app however when I run the app on production server it gives below exception.
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.AutorecoveringConnection.Init(IFrameHandler fh)
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 LiveStatisticsBroker.CheckAndUpdateSessionStatus() in LiveStatistics.cs:line 105
There are no changes in the code and if I revert to the previous release it works fine. I have checked network connectivity and there are no issues even if I telnet the server IP and with port 5671 it gets succeeded.
Strange thing is If I place same release on development server rabbitmq gets connected. Our development servers also follow same network rules. I have been stuck on this for some time and couldn't get any success.
Upgrading RabbitMq.Client nuget package from 6.2.1 to 6.5.0 did the trick for me. System.Memory was also upgraded as a dependency.