我正在尝试完成Identityserver4教程。样本继续使用sqlite,但我尝试将其转换为Azure托管的sqlserver。那时,我遇到了这个错误。
Keyword not supported: 'server'
尽管连接字符串指向sql server,并且seed方法引用sqlserver方法而不是sqlite,但仍会发生这种情况。
//services.AddDbContext<ApplicationDbContext>(options =>
// options.UseSqlite(connectionString));
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(connectionString));
[还有其他具有相同错误的问题,但这仅针对身份服务器]
我发现,有两个地方是对sql服务器的引用。
以及Seed.cs文件,转到Startup.cs文件。您会发现另一种用法。
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
这将消除问题。