[identityserver4] Cannot drop the index 'PersistedGrants.IX_PersistedGrants_SubjectId_ClientId_Type', because it does not exist or you do not have permission.

[identityserver4] Cannot drop the index 'PersistedGrants.IX_PersistedGrants_SubjectId_ClientId_Type', because it does not exist or you do not have permission.

link:

https://identityserver4.readthedocs.io/en/latest/quickstarts/5_entityframework.html#initializing-the-database

按照官方文档练习 ids4 时如果遇到如题报错, 可能是由于

dotnet ef migrations add InitialIdentityServerPersistedGrantDbMigration -c PersistedGrantDbContext -o Data/Migrations/IdentityServer/PersistedGrantDb

dotnet ef migrations add InitialIdentityServerConfigurationDbMigration -c ConfigurationDbContext -o Data/Migrations/IdentityServer/ConfigurationDb

你的这两条命令执行的顺序不对导致.

删除项目的所有migration, 先执行

dotnet ef migrations add InitialIdentityServerConfigurationDbMigration -c ConfigurationDbContext -o Data/Migrations/IdentityServer/ConfigurationDb

再执行

dotnet ef migrations add InitialIdentityServerPersistedGrantDbMigration -c PersistedGrantDbContext -o Data/Migrations/IdentityServer/PersistedGrantDb

https://github.com/IdentityServer/IdentityServer4/issues/3684

it works for me, hope can help you.

posted @ 2020-03-04 16:28  YanyuWu  阅读(495)  评论(0编辑  收藏  举报