我一直在試圖讓IdentityServer4版本1.5.2工作幾天沒有成功。我正在使用VS2017 My Entity類,DataContexts,存儲庫和遷移駐留在.Net標準庫(1.6)中。到目前爲止,除了當我爲「PersistenGrantDbContext」和「ConfigurationDbCOntext」運行update-migration命令時,這是非常好的。我得到的錯誤信息更新遷移命令失敗ConfigurationDbContext和PersistentGrantDbContext
Could not load file or assembly 'System.Data.SqlClient, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
,我創建自己似乎沒有執行「IDbContextFactory」界面 這裏我有兩個匪徒實施後有這個問題在DataContext類
public class TemporaryDbContextFactoryScopes : IDbContextFactory<PersistedGrantDbContext>
{
public PersistedGrantDbContext Create(DbContextFactoryOptions options)
{
var builder = new DbContextOptionsBuilder<PersistedGrantDbContext>();
builder.UseSqlServer("Server=-------;Database=-----------;Trusted_Connection=True;MultipleActiveResultSets=true",
optionsBuilder => optionsBuilder.MigrationsAssembly(typeof(UserDbContext).GetTypeInfo().Assembly.GetName().Name));
return new PersistedGrantDbContext(builder.Options, new OperationalStoreOptions());
}
}
public class TemporaryDbContextFactoryOperational : IDbContextFactory<ConfigurationDbContext>
{
public ConfigurationDbContext Create(DbContextFactoryOptions options)
{
var builder = new DbContextOptionsBuilder<ConfigurationDbContext>();
builder.UseSqlServer("Server=---------;Database=--------;Trusted_Connection=True;MultipleActiveResultSets=true",
optionsBuilder => optionsBuilder.MigrationsAssembly(typeof(UserDbContext).GetTypeInfo().Assembly.GetName().Name));
return new ConfigurationDbContext(builder.Options, new ConfigurationStoreOptions());
}
}
我有安裝最新版本的System.Data.SqlClient仍然不能正常工作
而最新的一個版本號是4.1.0.0,如錯誤報告? – Mashton
沒有最新版本是4.3.1,但我設法通過非正統手段解決它 –