首页 > 数据库 >EF CORE 遇到“无法打开登录所请求的数据库 "win7bc"。登录失败。”

EF CORE 遇到“无法打开登录所请求的数据库 "win7bc"。登录失败。”

时间:2022-10-13 00:44:41浏览次数:42  
标签:CORE 登录 数据库 EF win7bc db1DbContext DbContextOptions options

报错内容:
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>

标签:CORE,登录,数据库,EF,win7bc,db1DbContext,DbContextOptions,options
From: https://www.cnblogs.com/runliuv/p/16786643.html

相关文章

  • Codeforces Round #826 (Div. 3)
    F.Multi-ColoredSegments观察:如果某个位置上有大于等于两种不同的颜色,这个位置就可以更新任何颜色的线段的答案。基于观察就可以通过模拟来解决问题了。大概就是先离......
  • .Net Core 依赖注入
    依赖注入控制反转(inversionofcontrol,IOC)是设计模式中非常重要的思想,而依赖注入(dependencyinjection,DI)是控制反转思想的一种重要的实现方式。依赖注入简化了模块的组装......
  • IE和Firefox都兼容性的JS代码书写方式
    1.document.form.item问题(1)现有问题:现有代码中存在许多document.formName.item("itemName")这样的语句,不能在MF下运行(2)解决方法:改用document.formName.elements[......
  • 巧用Ajax的beforeSend 提高用户体验
    jQuery是经常使用的一个开源js框架,其中的$.ajax请求中有一个beforeSend方法,用于在向服务器发送请求前执行一些动作。具体可参考jQuery官方文档:​​​http://api.jquery.com......
  • CSharp: Simple Factory Pattern in donet core 3
     ///<summary>///简单工厂模式SimpleFactoryPattern///geovindu,GeovinDuedit///动物///</summary>publicinterfaceIAnimal......
  • CSharp: Interpreter Pattern in donet core 3
     ///<summary>/// 解释器模式InterpreterPattern/// geovindu,GeovinDuedit///</summary>interfaceEmployee{///<sum......
  • 关于Gitlab-配置SSH Keys-及使用Git命令行进行登录克隆
    如果是需要使用Git对自己Gitlab上的代码进行clone,过程如下:1、首先需要在Gitlab上配置sshkeys  配置方法:设置--> SSHKeys-->添加公钥信息,输入一个Title-->Addkey......
  • Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'pa
    1.报错图示:2.问题原因:3.问题解决:spring-cloud-nacos-config-namespace:命名空间的ID4.参考:https://www.bilibili.com/video/BV1LQ4y127n4/?p=26&vd_source=7d1......
  • vue 给元素或子组件添加标识ref
    给元素或子组件注册引用信息(id的替代者)//添加ref<h1ref="title"></h1>//相当于<h1id="title"></h1>//获取refthis.$refs.title;//相当于document.getElementById("title")......
  • 创建转储外向交货单 CreateFr…
    还是首先看前台:事务代码:VL10B点击采购订单标签页,输入装运点,采购凭证,交货创建日期计算规则默认为9,​​​​可以就这么空着,直接点执行,会显示满足条件的凭证号......