oce*_*rer 27 sql-server authentication iis asp.net-mvc kerberos
我正在使用C#和ASP.NET MVC开发一个Intranet站点.我在一台计算机上安装了SQL Server,而在另一台计算机上运行IIS.我希望用户访问Intranet站点,而不提示用户Internet Explorer将用户Windows凭据发送到IIS,然后将这些凭据传递给sql server,这意味着sql server可以看到用户访问数据库.
我知道Kerberos双跳问题,我正试图绕过这个问题.目前我可以让IE将Windows凭据传递给IIS并进行身份验证.我只是无法让IIS将这些凭据传递给SQL Server,而是当前在应用程序池标识下运行请求,该标识设置为域服务帐户"htu\srv-htu-iis".
我的设置如下:
Web.Config中
<system.web>
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
<identity impersonate="true" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
连接字符串
connection string="data source=hturesbsqlp01;initial catalog=R2_Dev;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework""
Run Code Online (Sandbox Code Playgroud)
IIS身份验证设置
Anonymous Authentication = Disabled
ASP.NET Impersonation = Enabled
Forms Authentication = Disabled
Windows Authentication = Enabled
Run Code Online (Sandbox Code Playgroud)
IIS应用程序池设置
Managed Pipeline = Integrated
Identity = htu\srv-htu-iis (domain service account)
Run Code Online (Sandbox Code Playgroud)
Active Directory设置
域服务帐户htu\srv-htu-iis已设置服务主体名称,该名称将我们的站点与帐户相关联.
活动目录有
Allow Delagation to any service
Run Code Online (Sandbox Code Playgroud)
SQL Server在其自己的SQL域服务帐户下运行.
测试
我运行了以下代码测试:
System.Web.HttpContext.Current.User.Identity.Name
Run Code Online (Sandbox Code Playgroud)
这正确地返回访问该站点的用户的Windows凭据
System.Security.Principal.WindowsIdentity.GetCurrent().Name
Run Code Online (Sandbox Code Playgroud)
返回域服务帐户"htu\srv-htu-iis",这是运行应用程序池标识的内容.
任何人都可以提供我可能出错的方向吗?
归档时间: |
|
查看次数: |
22940 次 |
最近记录: |