Make ASP.NET Identity Store User Data In Mongo (Hosted On Heroku)

Viewed 8413

Im currently working on an ASP.Net web app that uses Mongo as its backend. I have seen others try this and have changed my connection string in my Web.config to point to my Mongo instance on Heroku. My connection string format is as follows:

mongodb://username:password@server.mlab.com:port/database

The controllers and models built after creating a new ASP.Net MVC project with individual accounts selected have not been edited. I am unable to create new accounts or login with accounts I create through Mongo. I also received the following error:

Format of the initialization string does not conform to specification starting at index 0.

My research showed that this is typically due to a malformed connection string. I have double and triple checked my Mongo connection string but it looks right. Am I missing something?

Any help is appreciated!

---------------------------------------------

EDIT

I noticed that I had the providerName="System.Data.SqlClient" in the connection string. Removing this yields a different error:

The connection string 'DefaultConnection' in the application's configuration file does not contain the required providerName attribute.

3 Answers

If you're looking for MongoDB identity store adapters supporting netstandard2.0 or netcoreapp2.0, I've recently released a MongoDb UserStore and RoleStore adapter for Microsoft.AspNetCore.Identity 2.0.

It allows you to use MongoDb instead of SQL server with Microsoft.AspNetCore.Identity 2.0:

https://github.com/alexandre-spieser/AspNetCore.Identity.MongoDbCore

I have implemented the RoleStore and UserStore.

Fully covered by integration tests and unit tests from the modified Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test test suite.

Hope this helps.

Below is the most recent ones of all the available Identity Managers for Identity with MongoDB. I personally feel this is another promising NuGet package for Identity using MongoDB. definitely worth to try.

https://www.nuget.org/packages/AspNetCore.Identity.Mongo/

GitHub.com

https://github.com/matteofabbri/AspNetCore.Identity.Mongo
Related