C
C#15mo ago
pan andrzej

❔ MongoDB.Driver.MongoConnectionException:

Hi, I have problem with finding document in MongoDB collection. Whenever method collection.find is fired, it throws this error: MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.MissingMethodException: void System.Security.Cryptography.Rfc2898DeriveBytes..ctor(string,byte[],int,System.Security.Cryptography.HashAlgorithmName) here's code:
var client = new MongoClient("here's my uri");
var database = client.GetDatabase("test");
var collection = database.GetCollection<PlayerModel>("playerdatas");

var playerFilter = Builders<PlayerModel>.Filter.Eq("SteamID", player.UserId);
//this line throws error
var playerData = collection.Find(playerFilter).FirstOrDefault();
var client = new MongoClient("here's my uri");
var database = client.GetDatabase("test");
var collection = database.GetCollection<PlayerModel>("playerdatas");

var playerFilter = Builders<PlayerModel>.Filter.Eq("SteamID", player.UserId);
//this line throws error
var playerData = collection.Find(playerFilter).FirstOrDefault();
I'm using .NET framework 4.8.1, mongoDB 2.19.1 and Scram-SHA-1. Anyone know why it's happening?
7 Replies
phaseshift
phaseshift15mo ago
Missing method exception is a binary mismatch of some sort. E.g running in wrong runtime, or loading wrong versions of libs
pan andrzej
pan andrzej15mo ago
So I should downgrade Mongodb version?
phaseshift
phaseshift15mo ago
The version you mentioned should work, so it's probably something local on your machine that is setup wrong
pan andrzej
pan andrzej15mo ago
So what I should do in that case?
phaseshift
phaseshift15mo ago
Stack Overflow
System.MissingMethodException: Method not found?
Previous working asp.net webforms app now throws this error: System.MissingMethodException: Method not found The DoThis method is on the same class and it should work. I have a generic handler as...
pan andrzej
pan andrzej15mo ago
I tried everything, nothing worked 😕
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.