AddIdentity() fails “InvalidOperationException: Scheme already exists: Identity.Application”

I had a similar issue. This might be more helpful for people using .Net Core 3.0. After digging around I found out that once you create an “Identity” area using scaffolding. A file called “IdentityHostingStartup.cs” is created inside the Identity folder.

IdentityHostingStartup Location

Inside the class, another instance of “AddDefaultIdentity” is created along with a few other services.

IdentityHostingStartup File View

If you remove the “addDefaultIdentity” from your “Startup.cs” your app should start. Also, If you are getting a null connection string error. Update the connection string inside of the IdentityHostintgStartup.cs

Note: Deleting either of the addDefaultIdentities will work. You just can’t have it in both locations.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)