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

A timeout occured after 30000ms; not able to make a connection to MongoDB

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.8.1
    • Component/s: Connectivity
    • Labels:
      None
    • Environment:
      Windows 10, 32 bit, Visual Studio 2017, .net core 2.2

      Trying to setup a built and working .Net Core 2.2 Web application on my system. Have installed Mongo DB 4.0.

      Getting a run time error. Below is the exception thrown
       
      {{System.TimeoutExceptionHResult=0x80131505Message=A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, 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:27018" }

      ", EndPoint: "Unspecified/localhost:27018", State: "Disconnected", Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. --> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: No connection could be made because the target machine actively refused it [::1]:27018 at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.Sockets.Socket.<>c.<ConnectAsync>b__271_0(IAsyncResult iar)-- End of stack trace from previous location where exception was thrown — at MongoDB.Driver.Core.Connections.TcpStreamFactory.ConnectAsync(Socket socket, EndPoint endPoint, CancellationToken cancellationToken) at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStreamAsync(EndPoint endPoint, CancellationToken cancellationToken) at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)--- End of inner exception stack trace — at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken) at MongoDB.Driver.Core.Servers.ServerMonitor.HeartbeatAsync(CancellationToken cancellationToken)", LastUpdateTimestamp: "2019-08-09T15:11:24.7506020Z" }] }.Source=MongoDB.Driver.CoreStackTrace:}}

      {{}}

      Have already tried appending '?connect=replicaSet' to the connection string as suggested here : https://groups.google.com/forum/#!topic/mongodb-csharp/O460OHiFjZs

       

      Connection string:

      {{"ConnectionStrings":

      {"DefaultConnection": "mongodb://localhost:27017,localhost:27018/?rs=SpeQue"}

      ,}}{{}}

            Assignee:
            Unassigned Unassigned
            Reporter:
            pranjalvatsa86@gmail.com Pranjal Vatsa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: