0

IdentityServer4와 함께 작업합니다.IDbContextFactory 메서드 또는 작업이 구현되지 않았습니다.

구성 데이터에 EF를 사용하고 싶습니다 (튜토리얼 [http://identityserver4.readthedocs.io/en/release/quickstarts/8_entity_framework.html]의 첫 번째 단계).

내 statup.cs dotnet ef migrations add InitialIdentityServerMigration -c PersistedGrantDbContextdotnet ef migrations add InitialIdentityServerPersistedGrantDbMigration -c PersistedGrantDbContext -o Data/Migrations/IdentityServer/PersistedGrantDb

및 오류 어떤 도움을 주시면 감사하겠습니다

An error occurred while calling method 'ConfigureServices' on startup class 'Startup'. Consider using IDbContextFactory to override the initialization of the DbContext at design-time. Error: The method or operation is not implemented. No DbContext named 'PersistedGrantDbContext' was found.

을 가지고 실행에 cmd에서

namespace IdentityServer 
{ 
    public class Startup 
    { 
       { 
      services.AddMvc(); 

      var connectionString = @"Data Source=CR08186\\sqlexpress;Initial Catalog=IdentityServer;Persist Security Info=True;User ID=sa;Password=MsSql2008"; 
      var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name; 

      // configure identity server with in-memory users, but EF stores for clients and resources 
      services.AddIdentityServer() 
       .AddTemporarySigningCredential() 
       .AddTestUsers(Config.GetUsers()) 
       .AddConfigurationStore(builder => 
        builder.UseSqlServer(connectionString, options => 
         options.MigrationsAssembly(migrationsAssembly))) 
       .AddOperationalStore(builder => 
        builder.UseSqlServer(connectionString, options => 
         options.MigrationsAssembly(migrationsAssembly))); 

     } 
} 

!

답변

0

그래서 사용 된 데이터베이스에 문제가있었습니다. 연결이 이미 존재하는 연결 데이터베이스입니다. 새 데이터베이스 (현재 존재하지 않음)를 선택하면 모든 것이 올바르게 작동합니다.