[英]Entity Framework not using connection string in app.config
My error message states 我的错误讯息状态
The underlying provider failed on Open 基础提供程序在打开时失败
and the InnerException states that the database cannot open by the requested login. 并且InnerException指出无法通过请求的登录名打开数据库。
The strange thing is that my connectionString is showing a different login than what's mentioned in the error. 奇怪的是,我的connectionString显示的登录名不同于错误中提到的登录名。 Why is the application using an incorrect connectionString than the one that's explicitly defined in my App.Config? 为什么应用程序使用的连接字符串比我的App.Config中明确定义的连接字符串错误?
Few common reasons why: 几个常见原因为何:
1) You aren't using that project as your StartUp Project 1)您没有将该项目用作启动项目
2) You didn't match the name in the config 2)您与配置中的名称不匹配
<connectionStrings>
<add name="YourContext"... >
</connectionStrings>
3) You are hard coding it in the YourContext.cs
3)您正在YourContext.cs
进行硬编码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.