title: Connection to mongo db using dotnetcore
body: <p>I'm testing the beta of the new MongoDB.Driver for c# compatible with dotnet core and I can't get the connection to work. I have a mongo server v3.3 running on a docker container under port 27017 and I can sucessfully access through either the console via <code>docker exec -it</code> and a GUI (Robomongo).</p>
  
  <p>I am using the <code>"MongoDB.Driver": "2.3.0-beta1"</code>, in my project.json and the code I run is the following:</p>
  
  <pre><code>public class Program
  {
      public static void Main(string[] args)
      {
          var client = new MongoClient("mongodb://localhost:27017");
  
          var db = client.GetDatabase("newdatabase");
  
          var collection = db.GetCollection&lt;Person&gt;("mycollection");
  
          collection.InsertOne(new Person{Id = "1", Age = 32});
      }
  
      public class Person
      {
          public string Id{ get; set;}
          public int Age{ get; set;}
      }
  }
  </code></pre>
  
  <p>The exception I get back is:</p>
  
  <pre><code>A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = WritableServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "Automatic", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/localhost:27017" }", EndPoint: "Unspecified/localhost:27017", State: "Disconnected", Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---&gt; System.PlatformNotSupportedException: This platform does not support connecting sockets to DNS endpoints via the instance Connect and ConnectAsync methods, due to the potential for a host name to map to multiple IP addresses and sockets becoming invalid for use after a failed connect attempt. Use the static ConnectAsync method, or provide to the instance methods the specific IPAddress desired.
     at System.Net.Sockets.Socket.Connect(IPAddress[] addresses, Int32 port)
     at System.Net.Sockets.Socket.Connect(String host, Int32 port)
     at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
     at System.Threading.Tasks.Task.Execute()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at MongoDB.Driver.Core.Connections.TcpStreamFactory.&lt;ConnectAsync&gt;d__7.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at MongoDB.Driver.Core.Connections.TcpStreamFactory.&lt;CreateStreamAsync&gt;d__4.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at MongoDB.Driver.Core.Connections.BinaryConnection.&lt;OpenHelperAsync&gt;d__48.MoveNext()
     --- End of inner exception stack trace ---
     at MongoDB.Driver.Core.Connections.BinaryConnection.&lt;OpenHelperAsync&gt;d__48.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at MongoDB.Driver.Core.Servers.ServerMonitor.&lt;HeartbeatAsync&gt;d__27.MoveNext()" }] }.
  </code></pre>
  
  <p>Is there something obvious that I am missing or misconfiguring or is it early days for this driver to be used?</p>