runliuv

runliuv@cnblogs

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

报错内容:
ex:An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure' to the 'UseSqlServer' call.
InnerException:无法打开登录所请求的数据库 "win7bc"。登录失败。
用户 'sa' 登录失败。

解决方法:
检查连接字符串,数据库名,用户名密码,IP等。

报错内容:

The DbContextOptions passed to the db1DbContext constructor must be a DbContextOptions<db1DbContext>.
When registering multiple DbContext types, make sure that the constructor for each context type has a DbContextOptions<TContext> parameter rather than a non-generic DbContextOptions parameter.

解决方法:
把:public db1DbContext(DbContextOptions options) : base(options)
写成:
public db1DbContext(DbContextOptions<db1DbContext> options) : base(options)

--
使用 泛型 DbContextOptions<TContext>

posted on 2022-10-13 00:29  runliuv  阅读(593)  评论(0编辑  收藏  举报