Будем весьма благодарны за любые мысли о том, что не так.Спасибо!
Сервер запущен со следующими флагами
mongodb-win32-x86_64-2008plus-ssl-4.0.2\bin\mongod --sslMode disabled --dbpath "C:\Users\foobar\AppData\Local\Temp\sj5ufivo.hgy" --port 27017 --bind_ip 127.0.0.1 --replSet singleNodeReplSet
Код приложения
MongoClient client = new MongoClient(@"mongodb://127.0.0.1:{0}/?connect=replicaSet;replicaSet=singleNodeReplSet".Formatted(port));
var admin = client.GetDatabase("admin");
var replConfig = new BsonDocument(new List<BsonElement>()
{
new BsonElement("_id", "singleNodeReplSet"),
new BsonElement("members", new BsonArray { new BsonDocument { { "_id", 0 }, { "host", "127.0.0.1:27017" } } })
});
var commandDocument = new BsonDocument("replSetInitiate", replConfig);
var replSet = admin.RunCommand<BsonDocument>(commandDocument);
Исключение
System.TimeoutException
HResult=0x80131505
Message=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 : "ReplicaSet", Type : "ReplicaSet", State : "Connected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "127.0.0.1:27017" }", EndPoint: "127.0.0.1:27017", State: "Connected", Type: "ReplicaSetGhost", WireVersionRange: "[0, 7]" }] }.
Source=MongoDB.Driver.Core
StackTrace:
at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)
at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)
at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelection(CancellationToken cancellationToken)
at MongoDB.Driver.MongoClient.AreSessionsSupported(CancellationToken cancellationToken)
at MongoDB.Driver.OperationExecutor.StartImplicitSession(CancellationToken cancellationToken)
at MongoDB.Driver.MongoDatabaseImpl.UsingImplicitSession[TResult](Func`2 func, CancellationToken cancellationToken)
at MongoDB.Driver.MongoDatabaseImpl.RunCommand[TResult](Command`1 command, ReadPreference readPreference, CancellationToken cancellationToken)