Search code examples
mongodbservicestackmongodb-.net-driver

Mongodb auth with servicestack throws missing method exception


I've just configured ServiceStack to use Mongodb for authentication like this locally

public override void Configure(Container container)
{
    Plugins.Add(new AuthFeature(()=> new AuthUserSession(), new IAuthProvider[]{new BasicAuthProvider(), }));

    var mongoClient = new MongoClient("mongodb://localhost");
    var server = mongoClient.GetServer();
    var db = server.GetDatabase("letters");

    container.Register<ICacheClient>(new MemoryCacheClient());
    container.Register<IUserAuthRepository>(new MongoDBAuthRepository(db, true));
}

When I start the service I get the following exception: MissingMethodException: Method not found: 'MongoDB.Driver.SafeModeResult MongoDB.Driver.MongoCollection`1.Save(!0)'

Is this a bug in the provider or am I missing something for using the provider?


Solution

  • Downgraded the Mongo Csharp driver to versio 1.6.1 and now it works. The provider might need a update. Submitted a ticket here:

    https://github.com/ServiceStack/ServiceStack.Contrib/issues/16