Can't run mongodb in .Net C# MVC4 web app - localhost

0
        MongoClientSettings settings = new MongoClientSettings();
        settings.Server = new MongoServerAddress("localhost", 27017);

        var client = new MongoClient(settings);

        var database = client.GetDatabase("test");
        var collection = database.GetCollection<Logs>("testlogs");
        var query = Builders<Logs>.Filter.Eq("itemName", "Nasri");
        var entity = collection.Find(query).FirstOrDefault();

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 : "Automatic", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/localhost:27017" }", EndPoint: "Unspecified/localhost:27017", ReasonChanged: "ServerInitialDescription", State: "Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown", LastHeartbeatTimestamp: null, LastUpdateTimestamp: "2020-08-07T16:47:06.7800654Z" }] }.

c#
.net
mongodb
asp.net-mvc-4
localhost

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0