AngularASPNETCoreOAuth icon indicating copy to clipboard operation
AngularASPNETCoreOAuth copied to clipboard

PersistedGrantDbContext issue

Open sanpunind opened this issue 5 years ago • 3 comments

following command doesn't create respective entities into database , also I don't see consent page after login ,

AuthServer.Infrastructure> dotnet ef database update --context PersistedGrantDbContext

Please suggest

sanpunind avatar Mar 28 '20 02:03 sanpunind

Do you receive an exception when running this?

mmacneil avatar Mar 28 '20 16:03 mmacneil

The same issue with standalone SQL Server. I have changed appsettings connection string (CS). But it is still present for second migration. Fix the next lines with the correct CS: public PersistedGrantDbContext CreateDbContext(string[] args) { var optionsBuilder = new DbContextOptionsBuilder<PersistedGrantDbContext>(); optionsBuilder.UseSqlServer("Server=(localdb)\mssqllocaldb;Database=AuthServer;Trusted_Connection=True;MultipleActiveResultSets=true", sql => sql.MigrationsAssembly(typeof(PersistedGrantDbContextFactory).GetTypeInfo().Assembly.GetName().Name)); return new PersistedGrantDbContext(optionsBuilder.Options, new OperationalStoreOptions()); }

GothicSecret avatar Mar 26 '21 23:03 GothicSecret

Resolved as so:

This exception occurs because one might not have adjusted their "Connection String" as one did in the two of "appsettings.json". The adjustment made there needs to be done in the connection string in this class.

This is the syntax just in case for those who are still skeptical Server=ServerName;Database=DatabaseName;Trusted_Connection=True;

CelestialArcadia avatar Dec 22 '21 13:12 CelestialArcadia