我创建了一个aspnet核心Web应用程序,并安装了IdentityServer4和IdentityServer4.EntityFramework软件包,以便将数据库存储用于客户端和资源配置,而不是inMemory。但是,当我在服务集合中添加ConfigurationDbContext和PersistedGrantDbContext时,如下图所示 我收到一个异常,说“试图激活IdentityServer4.EntityFramework时无法解析类型为”IdentityServer4.EntityFramework.Options.OperationalStoreOptions“的服务。 DbContexts.PersistedGrantDbContext”。” 如被看见在命令行下面的截图如何解析类型为'IdentityServer4.EntityFramework.Options.OperationalStoreOptions'的服务
如何解决异常被抛出
你能澄清为什么你手动注册类型,而不是使用'services.AddIdentityServer().AddConfigurationStore(builder => ...)'扩展方法根据文档? –
当我不手动时,我得到一个错误,如** No DbContext名为'PersistedGrantDbContext'找到**。如果你看第63行,我确实使用了AddConfigurationStore扩展方法,但是在添加迁移时会引发错误 –
从我可以看到它应该[开箱即用](https://github.com/scottbrady91/IdentityServer4-Example/blob/master/src/ScottBrady91.IdentityServer4.Example/Startup.cs)。你确定你正在使用'AddOperationalStore'和'AddConfigurationStore'来配置你的永久存储吗? –