Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-500

If host names in replica set connection string are aliases of the host names in the replica set config connection fails the first time

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.6
    • Affects Version/s: 1.4.2
    • Component/s: None
    • Labels:
      None

      To reproduce (with replica set configured with actual host names and not numeric IP addresses):

      var server = MongoServer.Create("mongodb://127.0.0.1:10001,127.0.0.1:10002,127.0.0.1:10003/?safe=true");
      var database = server.GetDatabase("test");
      var collection = database.GetCollection("test");
      
      for (int i = 0; i < 3; i++)
      {
          try
          {
              Console.WriteLine("Count = {0}", collection.Count());
          }
          catch (Exception ex)
          {
              Console.WriteLine(ex.Message);
          }
      }
      

      Output is:

      Unable to connect to the primary member of the replica set.
      Count = 1
      Count = 1
      

            Assignee:
            craig.wilson@mongodb.com Craig Wilson
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: