我目前在使用 SSRS 时遇到一些问题。我有一个使用 Windows 身份验证的 ASP.NET 网站。这工作正常,我知道网站当前用户是当前登录的用户。
此站点上有一个 Web 表单 ReportViewer。当我不设置凭据时,这工作正常。然而,查看 SQL Server 中报告的执行日志,用户名列为 DOMAIN\MACHINE。
我尝试将 ReportServerCredentials 属性设置为如下所示的类:
[Serializable]
public class ReportCredentials : IReportServerCredentials
{
public bool GetFormsCredentials(out Cookie authCookie, out string userName, out string password, out string authority)
{
authCookie = null;
userName = null;
password = null;
authority = null;
return false;
}
public WindowsIdentity ImpersonationUser
{
get {
return (WindowsIdentity)HttpContext.Current.User.Identity;
}
}
public ICredentials NetworkCredentials
{
get {
return null;
}
}
}
但是,当执行此代码时,我现在从 Web 服务和报告服务返回 401。
这是怎么回事?他们都在同一个域中。我想使用当前用户而不是当前机器。如果我在报表服务器上运行报表,它会在正确的用户名下列出,而不是来自我的网站。
我在这里遇到了自己的麻烦,但最终还是成功了。
机器1:客户端浏览器
机器2:网络服务器
机器3:SSRS + SQL Server
为了解决双跃点问题,我让 IT 部门为 Machine2 打开 Active Directory 委派,设置为“信任此计算机以委派任何服务(仅限 Kerberos)”。
在我的网络服务器上,我修改了 Web.config 文件以具有:
<authentication mode="Windows"/>
<identity impersonate="true"/>
在 SSRS 服务器上,我修改了 rsreportserver.config 文件,添加<RSWindowsNegotiate/>
to the <AuthenticationTypes>
部分。我相信默认值是<RSWindowsNTLM/>
。我只是把两者都留在那里,给了我:
我重新启动了 SSRS 服务器,一切都开始工作。
希望这对某人有帮助!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)