Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

203
Visualizações
Exception occurs when using MongoDB driver for DotNet Core

I'm working on solution on the following stack:

  • ASP.NET Core
  • .NET Core
  • MongoDB

...using this driver for communication with the database: https://www.nuget.org/packages/MongoDB.Driver.Core/ ...version 2.4.1

I'm trying to instantiate the MongoClient like this:

var options = provider.GetService<IOptions<MongoDbSettings>>();
var client = new MongoClient(options.Value.ConnectionString);

But the last statement errors out saying:

An exception of type 'System.MissingMethodException' occurred in MongoDB.Driver.dll but was not handled in user code

and

Additional information: Method not found: 'Void MongoDB.Driver.ReadPreference..ctor

I've noticed that the class MongoClient is in the MongoDB.Driver -namespace, not in MongoDB.Driver.Core. Does that mean it is not compatible with .Net Core? If so, how do I then connect to the database?

All help appreciated!

Regards, Jon

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I ended up using this driver: http://mongodb.github.io/mongo-csharp-driver/

version 2.3.0, which solved the problem.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda