这是我一直在努力做我可以模拟使用表单身份验证进行身份验证的客户端并建立到SQL Server的可信连接吗?
建立与窗体身份验证和Active Directory成员的ASP.NET MVC 3应用程序。 Web服务器和数据库是不同的物理服务器,因此是双跳。
我以为答案是constrained delegation and protocol transition上的这篇较旧的文章?到目前为止,我还没有能够获得这项技术的工作。
我正在测试这从我的DEV机器(Windows 7,IIS7)的Web服务器部署到生产设置中的Windows 2008(IIS7)之前。 Windows 2008会有所作为吗?
什么可行,什么失败
我能够与窗体身份验证和AD会员登录。这似乎工作正常。当我试图让使用此代码数据库调用:
public void AsUser(Action action)
{
using (var id = new WindowsIdentity(User.Identity.Name + @"@example.com"))
{
WindowsImpersonationContext context = null;
try
{
context = id.Impersonate();
action.Invoke();
}
catch (Exception ex)
{
// ex.Message is The type initializer for System.Data.SqlClient.SqlConnection threw an exception
// buried inner exeption is Requested registry access is not allowed
}
finally
{
if (context != null)
{
context.Undo();
}
}
}
}
它失败的异常导致我相信我有我的本地开发服务器上设置问题。内部例外是Requested registry access is not allowed
。
如果我的电话Impersonate()
我看到ImpersonationLevel
设置为Identification
后设置一个断点,并检查WindowsIdentity
。这似乎是一个线索,它没有正确设置。有人可以确认吗?
我在正确的轨道上,这甚至可以设置?任何指针,将不胜感激。
64位。这很重要吗? – 2011-02-21 22:14:56
有时。在这种情况下,我怀疑它。更多信息总是更好,但 – Spidy 2011-02-21 22:17:11