{"无法打开数据库\" Namespace.Model.DbContext \"登录请求。登录失败用户登录失败'域\\ myusername'。"}

时间:2015-03-25 08:38:27

标签: c# asp.net-mvc entity-framework

我继续使用内部异常

获取EntityException
  

{"无法打开数据库\" Namespace.Model.DbContext \"要求的   登录。登录失败用户' Domain \ myusername'登录失败。"}

我显然已经重命名了doman和用户名以及命名空间模型和继承的dbcontext类名。

疑似故障1,连接字符串:

 <add name="Connection2" 
         connectionString="
         Data Source=(LocalDB)\v11.0;
         Database=EmployeeDB;
         Integrated Security=True" />

疑似错误2,代码:

List<Employee> employees = employeeContext.Employees.ToList();

2 个答案:

答案 0 :(得分:1)

确保在数据库用户中添加用户并将其设置为db_owner:

Example of security section

Example of adding new user

有关详细信息,请查看此Link

答案 1 :(得分:1)

我认为事实证明我使用的是实体框架但没有提供providerName="System.Data.SqlClient"