0

I'm attempting to integrate AspNetCore.Identity.MongoDbCore into my application. However, upon running the application, I encounter the following error:

System.MissingMethodException: 'Method not found: 'Void MongoDB.Bson.BsonDefaults.set_GuidRepresentationMode(MongoDB.Bson.GuidRepresentationMode)'.'

Here is the relevant portion of my code:

builder.Services.AddIdentityCore<ApplicationUser>()
        .AddRoles<MongoIdentityRole>()
        .AddMongoDbStores<ApplicationUser, MongoIdentityRole, Guid>(connectionUri, "databasename")
        .AddSignInManager()
        .AddDefaultTokenProviders();

Could anyone advise on how to resolve this issue or what might be causing it?

.net8/AspNetCore.Identity.MongoDbCore 6.0/MongoDbDriver 3.3.0

1
  • 2
    Maybe I go into the wrong direction, but when I add your codes and nuget packages into my .Net 8 mvc project, I didn't get your error. I deduce the error is coming from a version-mismatch issue. May I know whether it helped or not when using lower version of MongoDbDriver, such as 2.28.0? Commented Apr 8 at 2:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.