1

I HAVE THIS PROBLEM:

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", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "172.16.1.24:27017" }", EndPoint: "172.16.1.24:27017", State: "Disconnected", Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 172.16.1.24:27017 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization) --- 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.d__4.MoveNext() in D:\jenkins\workspace\mongo-csharp-driver-2.0.x-build\src\MongoDB.Driver.Core\Core\Connections\TcpStreamFactory.cs:line 126 --- 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.d__3.MoveNext() in D:\jenkins\workspace\mongo-csharp-driver-2.0.x-build\src\MongoDB.Driver.Core\Core\Connections\TcpStreamFactory.cs:line 55 --- 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.d__32.MoveNext() in D:\jenkins\workspace\mongo-csharp-driver-2.0.x-build\src\MongoDB.Driver.Core\Core\Connections\BinaryConnection.cs:line 201 --- End of inner exception stack trace --- at MongoDB.Driver.Core.Connections.BinaryConnection.d__32.MoveNext() in D:\jenkins\workspace\mongo-csharp-driver-2.0.x-build\src\MongoDB.Driver.Core\Core\Connections\BinaryConnection.cs:line 225 --- 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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at MongoDB.Driver.Core.Servers.ClusterableServer.d__34.MoveNext() in D:\jenkins\workspace\mongo-csharp-driver-2.0.x-build\src\MongoDB.Driver.Core\Core\Servers\ClusterableServer.cs:line 245" }] }.

        var conString = "mongodb://172.16.1.24:27017";
        var client = new MongoClient(conString);
        var server = client.GetServer();
        var database = server.GetDatabase("knjigoMata");
        var collection = database.GetCollection<ModelKorisici >("kljenti");

        //var entity = collection.FindAll();

        BindingList<ModelKorisici > doclist = new BindingList<ModelKorisici >();

        foreach (var deger in collection.FindAll())
        {
            doclist.Add(deger);
        }
        return doclist;
Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
  • Possible duplicate of [MongoDB C# 2.0 TimeoutException](https://stackoverflow.com/questions/29832622/mongodb-c-sharp-2-0-timeoutexception) – kenorb Oct 16 '17 at 16:29

0 Answers0