title: RabbitMQ C# connection trouble when using a username and password
body: <p>I am at a loss here so I'm reaching out to the collective knowledge in hope of a miracle.</p>
  
  <p>I have installed RabbitMQ on a Linux box using the defaults.</p>
  
  <p>When I use this code (and the default RabbitMQ installation configuration) everything works nice.</p>
  
  <pre><code>var connectionFactory = new ConnectionFactory();
  connectionFactory.HostName = "192.168.0.12";
  IConnection connection = connectionFactory.CreateConnection();
  </code></pre>
  
  <p>But when I add a user to RabbitMQ and try to use the following code (username and password has been changed to protect the innocent. :) )</p>
  
  <pre><code>var connectionFactory = new ConnectionFactory();
  connectionFactory.HostName = "192.168.0.12";
  connectionFactory.UserName = "user";
  connectionFactory.Password = "password";
  IConnection connection = connectionFactory.CreateConnection();
  </code></pre>
  
  <p>the <code>connectionFactory.CreateConnection()</code> method throws the following exception:</p>
  
  <pre><code>BrokerUnreachableException    
  None of the specified endpoints were reachable
  </code></pre>
  
  <p>Checking the RabbitMQ logfile I can see it complaining about the credentials:</p>
  
  <pre><code>{amqp_error,access_refused,
  "PLAIN login refused: user 'user' - invalid credentials",
  'connection.start_ok'}}
  </code></pre>
  
  <p>The thing is that I am confident about the username and password and I cannot for the love of coding find a solution to this anywhere.</p>
  
  <p>I must be missing something obvious but I can't figure out what it is.
  I would be grateful for any helpful pointers.</p>