[SERVER-62093] Failing to connect to Atlas from C# Created: 16/Dec/21  Updated: 16/Dec/21  Resolved: 16/Dec/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Ian Hannah Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

We have a test Atlas database up and running.

We can connect to it using Mongo Shell and list the collections from the database successfully.

However, when we try and connect using C# (running the following code):

var settings = MongoClientSettings.FromConnectionString("mongodb+srv://menadmin:<our password here>@cluster0.k2loi.mongodb.net/MAP?retryWrites=true&w=majority");
var client = new MongoClient(settings);
var dbList = client.ListDatabases().ToList();

Where <our password here> is replaced by our password. Running this code gives this error:

System.TimeoutException: 'A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector

{ AllowedLatencyRange = 00:00:00.0150000 }

, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "ReplicaSet", Type : "ReplicaSet", State : "Disconnected", Servers : [{ ServerId: "

{ ClusterId : 1, EndPoint : "Unspecified/cluster0-shard-00-00.k2loi.mongodb.net:27017" }

", EndPoint: "Unspecified/cluster0-shard-00-00.k2loi.mongodb.net:27017", ReasonChanged: "Heartbeat", State: "Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server.
---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (10060): 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. 52.31.23.157:27017

We are using version 2.14.1 of the C# Mongo drivers. It also fails using version 2.10.4 with the same error. We have also tried the code from a .NET framework application and a .NET core application with the same result.

Do you have any idea what the issue could be?

 



 Comments   
Comment by Edwin Zhou [ 16/Dec/21 ]

Hi ihannah@meniscus.co.uk,

The SERVER project is for bugs and feature suggestions for the MongoDB server. To inform our Atlas team of issues you are having, please reach out to the Atlas support team via Intercom. You can do this by clicking the round button at the bottom right of the cluster view page in Atlas.

Best,
Edwin

Generated at Thu Feb 08 05:54:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.