我一直在得到一个EntityException,其内部异常为{“无法打开数据库”Namespace.Model.DbContext “登录请求登录失败用户'Domain \ myusername'登录失败。”}
{ “无法打开数据库\” Namespace.Model.DbContext \ “由 登录请求。登录失败登录失败,用户 '域\名为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();
你的域用户没有得到对数据库的访问。你有没有检查访问权限? – JamesT 2015-03-25 08:46:09