我一直在试图让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,但我设法通过非正统手段解决它 –