I updated a project to ASP.NET Core 2 today and I get the following error:
Cannot consume scoped service IMongoDbContext from singleton IActiveUsersSe
You can also add
.UseDefaultServiceProvider(options =>
options.ValidateScopes = false)
before .Build() in Program.cs file to disable the validation.
Try this only for development testing, ActiveUsersService is singleton and has a larger lifetime than MongoDbContext which is scoped and will not get disposed.