Identityserver4: Invalid object name 'Clients'

Created on 2 Feb 2018  路  12Comments  路  Source: IdentityServer/IdentityServer4

Hello,
I am trying to generate migrations from a project hosting the Identity Server 4.
The project is configured with .NET core 2 and using the NUGET packages:

  • IdentityServer4 (2.1.1)
  • IdentityServer4.EntityFramework (2.1.1)

I've configured the Startup.cs as it should be, for instance:

.AddConfigurationStore(options => { options.ConfigureDbContext = builder => builder.UseSqlServer(connectionString, sql => sql.MigrationsAssembly(migrationsAssembly)); })
Also, I've added a DesignTimeFactory class as follows:

public ConfigurationDbContext CreateDbContext(string[] args) { IConfigurationRoot configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") .Build(); var builder = new DbContextOptionsBuilder<ConfigurationDbContext>(); var connectionString = configuration.GetConnectionString("DefaultConnection"); builder.UseSqlServer(connectionString, o => o.MigrationsAssembly(typeof(DesignTimeConfigurationDbContextFactory).GetTypeInfo().Assembly.GetName().Name)); var options = new ConfigurationStoreOptions(); return new ConfigurationDbContext(builder.Options, options); }
Then, I create an empty Database manually.

Finally, I run the following command:
dotnet ef migrations add InitConfiguration -c ConfigurationDbContext -o Data/Migrations/IdentityServer/ConfigurationDb
This is the result:
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] User profile is available. Using 'C:\Users\bhaidar\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. info: Microsoft.EntityFrameworkCore.Infrastructure[10403] Entity Framework Core 2.0.1-rtm-125 initialized 'ConfigurationDbContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: MigrationsAssembly=QuickstartIdentityServer fail: Microsoft.EntityFrameworkCore.Database.Command[20102] Failed executing DbCommand (6ms) [Parameters=[], CommandType='Text', CommandTimeout='30'] SELECT CASE WHEN EXISTS ( SELECT 1 FROM [Clients] AS [c]) THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT) END System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Clients'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader() at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues) ClientConnectionId:77501eaa-09eb-4308-bd8a-f6148333b4bb Error Number:208,State:1,Class:16 fail: Microsoft.EntityFrameworkCore.Query[10100] An exception occurred in the database while iterating the results of a query for context type 'IdentityServer4.EntityFramework.DbContexts.ConfigurationDbContext'. System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Clients'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader() at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues) at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.BufferlessMoveNext(Boolean buffer) at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext() at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.GetResult[TResult](IEnumerable`1 valueBuffers, Boolean throwOnNullResult) at lambda_method(Closure , QueryContext ) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass17_1`1.<CompileQueryCore>b__0(QueryContext qc) ClientConnectionId:77501eaa-09eb-4308-bd8a-f6148333b4bb Error Number:208,State:1,Class:16 System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Clients'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader() at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues) at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.BufferlessMoveNext(Boolean buffer) at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext() at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.GetResult[TResult](IEnumerable`1 valueBuffers, Boolean throwOnNullResult) at lambda_method(Closure , QueryContext ) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass17_1`1.<CompileQueryCore>b__0(QueryContext qc) ClientConnectionId:77501eaa-09eb-4308-bd8a-f6148333b4bb Error Number:208,State:1,Class:16 Application startup exception: System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Clients'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader() at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues) at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.BufferlessMoveNext(Boolean buffer) at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext() at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.GetResult[TResult](IEnumerable`1 valueBuffers, Boolean throwOnNullResult) at lambda_method(Closure , QueryContext ) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass17_1`1.<CompileQueryCore>b__0(QueryContext qc) at System.Linq.Queryable.Any[TSource](IQueryable`1 source) at QuickstartIdentityServer.Startup.InitializeDatabase(IApplicationBuilder app) in D:\Projects\aspnet-core-playground\src\PluralSightIdentityServer\05\TokenServiceDatabase\QuickstartIdentityServer\Startup.cs:line 111 at QuickstartIdentityServer.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env) in D:\Projects\aspnet-core-playground\src\PluralSightIdentityServer\05\TokenServiceDatabase\QuickstartIdentityServer\Startup.cs:line 100 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder) at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() ClientConnectionId:77501eaa-09eb-4308-bd8a-f6148333b4bb Error Number:208,State:1,Class:16 crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[6] Application startup exception System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Clients'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader() at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues) at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.BufferlessMoveNext(Boolean buffer) at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext() at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.GetResult[TResult](IEnumerable`1 valueBuffers, Boolean throwOnNullResult) at lambda_method(Closure , QueryContext ) at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass17_1`1.<CompileQueryCore>b__0(QueryContext qc) at System.Linq.Queryable.Any[TSource](IQueryable`1 source) at QuickstartIdentityServer.Startup.InitializeDatabase(IApplicationBuilder app) in D:\Projects\aspnet-core-playground\src\PluralSightIdentityServer\05\TokenServiceDatabase\QuickstartIdentityServer\Startup.cs:line 111 at QuickstartIdentityServer.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env) in D:\Projects\aspnet-core-playground\src\PluralSightIdentityServer\05\TokenServiceDatabase\QuickstartIdentityServer\Startup.cs:line 100 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) at Microsoft.AspNetCore.Hosting.Internal.AutoRequestServicesStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder builder) at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() ClientConnectionId:77501eaa-09eb-4308-bd8a-f6148333b4bb Error Number:208,State:1,Class:16 An error occurred while calling method 'BuildWebHost' on class 'Program'. Continuing without the application service provider. Error: Invalid object name 'Clients'.

question

Most helpful comment

Just for the protocol...
I changed the default schema to "identity" in Migration classes and I ran to this problem.
Found nothing which helped me solve the problem and I just played around with AddConfigurationStore options and set the options.DefaultSchema to "identity" and the problem solved...

AddConfigurationStore(options => { options.ConfigureDbContext = builder => builder.UseSqlServer(connString, sql => sql.MigrationsAssembly(migratioAssembly)); options.DefaultSchema = "identity"; });

All 12 comments

I suspect you left in the code in Startup that tries to seeds the DB.

Hi @brockallen
Indeed, I am calling this method from inside the Configure method in Startup and nothing there being called from inside the ConfigureSevices. I thought with EF Core 2.0, only ConfigureServices is called when doing migrations!

Is that wrong? How would that affect the migration thing? And how would I seed the DB?

````
private void InitializeDatabase(IApplicationBuilder app)
{
using (var serviceScope = app.ApplicationServices.GetService().CreateScope())
{
var context = serviceScope.ServiceProvider.GetRequiredService();
if (!context.Clients.Any())
{
foreach (var client in Config.GetClients())
{
context.Clients.Add(client.ToEntity());
}
context.SaveChanges();
}

            if (!context.IdentityResources.Any())
            {
                foreach (var resource in Config.GetIdentityResources())
                {
                    context.IdentityResources.Add(resource.ToEntity());
                }
                context.SaveChanges();
            }

            if (!context.ApiResources.Any())
            {
                foreach (var resource in Config.GetApiResources())
                {
                    context.ApiResources.Add(resource.ToEntity());
                }
                context.SaveChanges();
            }
        }
    }

````

I've been stuck on this for several hours. What's weird is that Quickstart #8, "QuickstartIdentityServer", does generate the tables when the DB doesn't exist, but taking out all of the ApplicationDbContext logic in "IdentityServerWithAspIdandEF" and thus almost the same startup.cs, still does NOT work.

Haven't found anything online about EF7 on Multiple Contexts and Migrations that is helping with the issue.

Hello @robrtrix

@brockallen's note above made me think that I might need to comment out the Seeding logic up until the database is created. Here is what I did to make it work:

  • Comment on the seed logic
  • Create an empty database manually
  • Generate migrations one per context (ConfigurationDbContext, PersistedGrantDbContext and UserDbContext)
  • Issue a "database update" comment one per context
  • Run the application
  • Stop the application
  • Uncomment the seed logic and run the application again

This should make the application up and run.

Hope this helps,
Bilal

@bhaidar Thank you.

So the Migrations weren't working because I think we were missing the .designer.cs files for the ConfigurationDb and the PersistedGrantDb contexts. I figured out the content of the .designer.cs is identical to the Snapshot file, except the additional [Migration("XXX")] attribute, and then the BuildTargetModel method name vs BuildModel, and the class name is the same as the derived Migration class name.

That worked.

I also remembered that the migrations worked out of the box for Quick Start 8. So I simply pulled the two .designer.cs files from there, dropped them into the project and fixed the root name space for each file.

Voila. That fixed it. So @brockallen I think all that needs to be done is just include the two missing .designer.cs files. You probably have them locally, just not included in the source.
/Data/Migrations/IdentityServer/ConfigurationDb/20171005153917_InitialIdentityServerConfigurationDbMigration.designer.cs
/Data/Migrations/IdentityServer/PersistedGrantDb/20171005153857_InitialIdentityServerPersistedGrantDbMigration.designer.cs

I also updated the EnsureSeedData to ensure they're all setup:

 using (var scope = serviceProvider.GetRequiredService<IServiceScopeFactory>().CreateScope())
            {
                var appContext = scope.ServiceProvider.GetRequiredService<IdentityServerWithAspNetIdentity.Data.ApplicationDbContext>();
                appContext.Database.Migrate();

                var persistedContext = scope.ServiceProvider.GetRequiredService<PersistedGrantDbContext>();
                persistedContext.Database.Migrate();

                var configContext = scope.ServiceProvider.GetRequiredService<ConfigurationDbContext>();
                configContext.Database.Migrate();
                EnsureSeedData(configContext);
            }

Rob

@brockallen's note above made me think that I might need to comment out the Seeding logic up until the database is created

Exactly. It's a chicken and egg issue. In the newer templates, I think we removed that approach for seeding.

Any update? Can we close this issue?

I'm about to hit quickstart 8. I'm waiting on some feedback to a question in StackOverflow (on quickstart 7 - I noticed that a lot of the model/views from quickstart 6 were just dropped out of the project) before moving forward. If I have trouble, I'll comment on it. That is, I'm pretty confused about the existence of models/views in the main project directory in QS6, while also having a similar folder structure under the "Quickstart" folder in the directory. Was getting duplicate class issues in quickstart 7.

Yeah, the quickstart 8 repo seeder migration works.

Just for the protocol...
I changed the default schema to "identity" in Migration classes and I ran to this problem.
Found nothing which helped me solve the problem and I just played around with AddConfigurationStore options and set the options.DefaultSchema to "identity" and the problem solved...

AddConfigurationStore(options => { options.ConfigureDbContext = builder => builder.UseSqlServer(connString, sql => sql.MigrationsAssembly(migratioAssembly)); options.DefaultSchema = "identity"; });

Run 2 command dotnet client :
dotnet ef migrations add InitialIdentityServerPersistedGrantDbMigration -c PersistedGrantDbContext -o Data/Migrations/IdentityServer/PersistedGrantDb
dotnet ef migrations add InitialIdentityServerConfigurationDbMigration -c ConfigurationDbContext -o Data/Migrations/IdentityServer/ConfigurationDb

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings