我在使用SSRS时遇到了一些问题。我有一个使用Windows身份验证的ASP.NET网站。这工作正常,我知道网站当前用户是当前登录的用户。使用SSRS ASP.NET ReportViewer和Web服务进行Windows身份验证
本网站是一个webforms 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回服务。
发生了什么事?他们都在同一个域。我想使用当前用户而不是当前机器。如果我在报告服务器上运行报告,它会在正确的用户名下列出,而不是来自我的网站。
叶我想,第一,但仍然有401 :( – Lloyd
其实我说了谎,一定已经被缓存,该报告目前运行,但用户名被记录为\t STAFF \ UKBRISDDWRKA424 $这是机器。哎呀。 – Lloyd