title: RabbitMQ C# connection trouble: None of the specified endpoints were reachable
body: <p>I have this code:</p>
  
  <pre><code>public class Rabbit
      {
          public IConnection GetConnection()
          {
              ConnectionFactory connectionFactory = new ConnectionFactory();
              Uri uri = new Uri("amqp://login:password@1.2.3.4:5672/host");
              connectionFactory.Uri = uri;
              return connectionFactory.CreateConnection();
          }
  
          public  void Send(string queue, string data)
          {
              using (IConnection connection = GetConnection())
              {
                  using (IModel channel = connection.CreateModel())
                  {
                      channel.QueueDeclare(queue, false, false, false, null);
                      channel.BasicPublish(string.Empty, queue, null, Encoding.UTF8.GetBytes(data));
  
                  }
              }
          }
  
          public  string  Receive(string queue)
          {
              using (IConnection connection = GetConnection())
              {
                  using (IModel channelconsumer = connection.CreateModel())
                  {
                      //channelconsumer.QueueDeclare(queue, false, false, false, null);
                      BasicGetResult result = channelconsumer.BasicGet(queue, true);
                      if (result != null)
                      {
                          string data = Encoding.UTF8.GetString(result.Body);
                          Console.WriteLine(data);
                          return data;
                      } else
                      {
                          return null;
                      }
                  }
              }
          }
      }
  </code></pre>
  
  <p>And i use it:</p>
  
  <pre><code>var rabbit = new Rabbit();
  rabbit.Send("name.sample.example", json); 
  </code></pre>
  
  <p>When I run this code I have error:</p>
  
  <p>RabbitMQ.Client.Exceptions.BrokerUnreachableException: „None of the specified endpoints were reachable”</p>
  
  <p>in line:</p>
  
  <pre><code>return connectionFactory.CreateConnection();
  </code></pre>
  
  <p>I have login, password Is 100% correct. 
  How to fix it?</p>