Web API和实体框架用户名问题

时间:2012-08-29 14:41:23

标签: asp.net-mvc entity-framework asp.net-web-api

所有

我有一个ASP.NET Web API项目,它在另一个项目中对我的服务层进行REST调用。服务项目的数据访问是通过Entity Framework 4.3实现的。 web.config文件中的连接字符串设置为使用集成安全性。

正在发生的事情是,服务器的名称“服务器A”正在传递给服务层,并且对SQL Server的身份验证失败。没有名为“服务器A”的用户帐户。

更具体地说,这就是架构的样子

jquery file making an api controller via POST to a method within the API controller
API controller method references the service layer DLL, and calls a method within the service class
The service class is calling a method in a repository class that uses DbContext to connect to SQl Server 2008 table.

在使用Web API框架将一个正确的用户名传递给EF时,我需要做些什么?

任何帮助都将不胜感激。

德里克

1 个答案:

答案 0 :(得分:1)

问题是双跳模仿。你可以阅读它by this link。 但我不确定通过REST可以实现这种模仿。我建议您通过特殊帐户使用数据库,而不是集成安全性。