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

Unable to connect to server 10.30.41.50:27017: 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

      Hi
      Using this simple lines code the driver is throwing an exception related with the socket timeout.

      // var client = new MongoClient("mongodb://10.30.41.50/DocumentManagerDataBase");

      var client = new MongoClient("mongodb://10.30.41.50/DocumentManagerDataBase/?socketTimeoutMS=30000");

      var server = client.GetServer();
      try

      { server.Connect(); }

      catch (Exception e)

      { throw; }

      Stacktrace information:

      Unable to connect to server 10.30.41.50:27017:
      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 10.30.41.50:27017.

      at MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)
      at MongoDB.Driver.MongoServer.Connect(TimeSpan timeout)
      at MongoDB.Driver.MongoServer.Connect()
      at UsingDocumentManagerAPI.API.Main(String[] args) in c:\PathAppsProjects\UsingDocumentManagerAPI\UsingDocumentManagerAPI\API.cs:line 30
      at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
      at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
      at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
      at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Threading.ThreadHelper.ThreadStart()

      If I change to my localhost it working fine, but for the other hots does not work.

      I dont have anny firewwal in the midlle, etc.

      My mongoDb database it hoted on Windows server 2012.
      If try to conect using any front end like RoboMongo or the shell, it workig fine, and I can retrive data from collection. but not through the api.
      Thanks
      MIKE

            Assignee:
            Unassigned Unassigned
            Reporter:
            mquintela Michael
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: