我正在尝试连接到 cosmos db,但出现超时错误。
System.TimeoutException: '使用 CompositeServerSelector { Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } } 选择服务器 30000 毫秒后发生超时。集群状态的客户端视图是 { ClusterId : '1', ConnectionMode : 'ReplicaSet', Type : 'ReplicaSet', State : 'Disconnected', Servers : [{ ServerId: '{ ClusterId : 1, EndPoint : 'Unspecified/testgp.文档.azure.com:10255'}',端点:'未指定/testgp.documents.azure.com:10255',状态:'断开连接',类型:'未知'}] }。
代码:
string connectionString =
@"mongodb://USERNAME:PASSWORD@testgp.documents.azure.com:10255/?ssl=true&replicaSet=globaldb";
MongoClientSettings settings = MongoClientSettings.FromUrl(
new MongoUrl(connectionString)
);
settings.SslSettings =
new SslSettings() { EnabledSslProtocols = SslProtocols.Tls12 };
var mongoClient = new MongoClient(settings);
var db = mongoClient.GetDatabase(DATABASENAME);
IAsyncCursor<BsonDocument> collectionList1 = db.ListCollections();
RoboMongo 错误: 在此处输入图像描述