网页API和Entity Framework用户名问题 [英] Web API and Entity Framework user name issue

查看:207
本文介绍了网页API和Entity Framework用户名问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有,

我有一个做一个REST调用在另一个项目中我的服务层的ASP.NET Web API项目。该服务项目的数据访问是通过实体框架4.3。在web.config文件中的连接字符串被设置为使用集成安全性。

I have a ASP.NET Web API project that is making a REST call to my service layer in another project. The service project's data access is via Entity Framework 4.3. The connection string in the web.config files is set to use Integrated Security.

正在发生的事情是,服务器的名称,服务器A,被传递到服务层,验证失败对SQL Server。没有命名的用户帐户服务器的位置。

What is happening is, the name of the server, "server A", is being passed to the service layer, and failing authentication against SQL Server. There isn't a user account named "server A."

更具体地讲,这是该架构是什么样子

More specifically this is what the architecture looks like

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.

有没有一些具体的事情我需要做,以降低传递正确的用户名EF使用Web API框架是什么时候?

Is there something specific I need to be doing when using the Web API framework in order to pass the correct user name down to EF?

任何帮助将是AP preciated。

Any help would be appreciated.

德里克

推荐答案

问题是双跳模拟。你可以阅读一下<一个href=\"http://weblogs.asp.net/owscott/archive/2008/08/22/iis-windows-authentication-and-the-double-hop-issue.aspx\"相对=nofollow>这个链接。
但我不知道,这样的模拟通过REST是可能的。我建议你​​通过特殊账户使用的数据库,没有集成安全性。

The problem is double hop impersonation. You can read about it by this link. But i'm not sure that such impersonation is possible via REST. I recommend you use database via special account, not integrated security.

这篇关于网页API和Entity Framework用户名问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆