asp.net-identity - 不支持关键字:“服务器”-身份服务器
问题描述
我正在尝试完成 identityserver4 教程。示例继续使用 sqlite,但我尝试转换为托管在 azure 上的 sqlserver。那时,我遇到了这个错误。
Keyword not supported: 'server'
尽管连接字符串指向 sql server,并且种子方法引用 sqlserver 方法而不是 sqlite,但仍会发生这种情况。
//services.AddDbContext<ApplicationDbContext>(options =>
// options.UseSqlite(connectionString));
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(connectionString));
[还有其他问题具有相同的错误,但这是专门针对身份服务器的]
解决方案
我发现,有两个地方引用了 sql server。
连同 Seed.cs 文件一起,转到 Startup.cs 文件。你会发现另一种用法。
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
这将消除这个问题。
推荐阅读
- python - 更新散景条形图点击上的数据表
- android - 如何在 Android Studio 上执行“使用 -Xlint 重新编译:未选中详细信息”?
- java - 使用 @BindingResult 的 Spring 注释验证
- html - 使用 dt 和 dd 的 CSS 列对齐
- python - `flask db upgrade` 运行良好,但随后对`flask db migrate` 的调用会删除所有表
- python - 为什么 Django 关系字段中不存在“on_update”选项?
- react-native - 本机模块不能为空 - React Native,Expo
- asp.net-core - 为什么注册用户没有显示在我的 AspNetUsers 表中,在 asp.net 核心 Web 应用程序中
- scala - 如何在不删除或替换任何元素的情况下将元素列表添加到某个索引处的另一个列表中
- php - 使用 jQuery 解析 Ajax 响应