I have set my IdentityServer4 in a service fabric project, all is working fine until I decided to stop loading my configuration in-memory and use the ConfigurationDb and PersistedGrantDb they have. I get the error on cmd of "Cant find PersistedGrantDbContext"; if I change the program.cs to run with the webhost code Im able to get it and create the migrations. Is there something Im missing here? Can it be done in a different way? This is my startup code for identity server, keep in mind I have the code related to load the context in comments for now.
const string connectionString = @"Data Source=.;Initial Catalog=DbIdentity;MultipleActiveResultSets=true; User ID=admin; Password=123";
var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
services.AddIdentityServer(options =>
{
options.Events.RaiseErrorEvents = true;
options.Events.RaiseInformationEvents = true;
options.Events.RaiseFailureEvents = true;
options.Events.RaiseSuccessEvents = true;
})
.AddInMemoryClients(IdentityServerConfiguration.GetClients(clientSettings))
.AddInMemoryApiResources(IdentityServerConfiguration.GetApiResources(clientSettings))
.AddInMemoryIdentityResources(IdentityServerConfiguration.GetIdentityResources())
// .AddDeveloperSigningCredential();
.AddSigningCredential(cert);
//.AddConfigurationStore(options =>
//{
// options.ConfigureDbContext = builder =>
// builder.UseSqlServer(connectionString,
// sql => sql.MigrationsAssembly(migrationsAssembly));
//})
//.AddOperationalStore(options =>
//{
// options.ConfigureDbContext = builder =>
// builder.UseSqlServer(connectionString,
// sql => sql.MigrationsAssembly(migrationsAssembly));
// options.EnableTokenCleanup = true;
// options.TokenCleanupInterval = 30;
//});
let me know if you need more context or code to figure this out. Thanks!