[rabbitmq-discuss] C# client connect using SSL

PoorRabbit yan.jiang at openbet.com
Wed Dec 4 12:18:10 GMT 2013


I had trouble connecting to RabbitMQ using c# client library with SSL enabled
too. But the exception I received is different, anyhow they are all to do
with certificate verification. Below is the code snippet:

            ConnectionFactory cf = new ConnectionFactory();

            cf.Uri = "amqp://user:pass@hostname:port/vhost";
            cf.Ssl.ServerName = System.Net.Dns.GetHostName();
            cf.Ssl.Enabled = true;

            using (IConnection conn = cf.CreateConnection())
            {
            }

<http://rabbitmq.1065348.n5.nabble.com/file/n31826/RabbitMQException.png> 

Eventually, I solved the problem by changing ssl settings to accept all
types of policy errors listed in SSLOption :-), as below:

            cf.Ssl.ServerName = System.Net.Dns.GetHostName();
            cf.Ssl.Enabled = true;
            cf.Ssl.AcceptablePolicyErrors =
System.Net.Security.SslPolicyErrors.RemoteCertificateChainErrors
                                            |
System.Net.Security.SslPolicyErrors.RemoteCertificateNameMismatch
                                            |
System.Net.Security.SslPolicyErrors.RemoteCertificateNotAvailable;

Took me half day to figure out. &*()(_(_^%%$

Hope it helps somebody struggling to get c# RabbitMQ client working.



--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/C-client-connect-using-SSL-tp31134p31826.html
Sent from the RabbitMQ mailing list archive at Nabble.com.


More information about the rabbitmq-discuss mailing list