我试图完成identityserver4教程。示例一直使用sqlite,但我尝试转换到azure上托管的sqlserver。当时,我遇到了这个错误。
Keyword not supported: 'server'
尽管连接字符串指向sql server,种子方法引用的是sql server方法而不是sqlite,但还是会发生这种情况。
//services.AddDbContext<ApplicationDbContext>(options =>
// options.UseSqlite(connectionString));
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(connectionString));
[还有其他问题也有相同的错误,但这是针对identityserver的]
我发现,有两个地方引用了sql server。
与Seed.cs文件一起,转到Startup.cs文件。你会发现另一种用法。
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
这将消除这个问题。