0

我有一个上有一个ReportViewer控件的ASP.NET应用程序:SSRS,和的ReportViewer ASP.NET拒绝访问

<rsweb:ReportViewer ID="rv" runat="server" ProcessingMode="Remote" 
      ShowParameterPrompts="False"AsyncRendering="true" > 
    <ServerReport ReportPath="<My Report>" ReportServerUrl="<Report Server URL>" /> 
</rsweb:ReportViewer> 

报表服务器不同的服务器比我的应用程序服务器上运行,所以我“M传递凭据当我打电话报告:

rv.ServerReport.ReportServerCredentials = New ReportCredentials() 
rv.ServerReport.SetParameters(params) 
rv.ServerReport.Refresh() 

凭证,在这个类:

<Serializable()> _ 
Public Class ReportCredentials 
Implements Microsoft.Reporting.WebForms.IReportServerCredentials 


Public Function GetFormsCredentials(ByRef authCookie As System.Net.Cookie, ByRef userName As String, ByRef password As String, ByRef authority As String) As Boolean Implements Microsoft.Reporting.WebForms.IReportServerCredentials.GetFormsCredentials 
    authCookie = Nothing 
    userName = Nothing 
    password = Nothing 
    authority = Nothing 

    Return False 
End Function 

Public ReadOnly Property ImpersonationUser() As System.Security.Principal.WindowsIdentity Implements Microsoft.Reporting.WebForms.IReportServerCredentials.ImpersonationUser 
    Get 
     Return Nothing 
    End Get 
End Property 

Public ReadOnly Property NetworkCredentials() As System.Net.ICredentials Implements Microsoft.Reporting.WebForms.IReportServerCredentials.NetworkCredentials 
    Get 
     Return New NetworkCredential(AppSettings("ReportUser"), Helpers.GetReportPassword(), AppSettings("ReportDomain")) 
    End Get 
End Property 

末级

在我的web.config文件中,我得到了impersonate =“true”。

我遇到的问题是,大多数用户收到此错误:如果我在我的帐户下运行的应用程序,然后让他们尝试自己的帐户它的工作原理下

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) 

。我可以通过回收应用程序正在运行的App Pool来重现错误。如果我在应用程序服务器上让用户成为本地管理员(就像我一样),那么它将工作,但显然我不想这样做。关于我在做什么错误的任何想法,以及为什么在我运行一次后突然为他们应用程序的原因?

回答

1

发现问题是访问应用程序服务器上的machine.config文件。由于我在IIS中使用模拟和集成身份验证来运行,因此该应用程序以登录用户身份运行。显然,在获取NetworkCredentials时,将访问machine.config。由于用户无法访问machine.config,因此失败。我猜测machine.config被缓存,所以这就是为什么它在我作为自己运行应用程序(管理员)后工作。我继续为现在的读者提供了对machine.config的读取权限给我的用户,并解决了这个问题。不知道是否有更好的方法来做到这一点。

+0

最后,我刚刚关闭模拟,因为我意识到我不需要它。然后,我不必再给machine.config任何额外的权限 – sbaum 2011-04-28 17:58:57

+0

你能告诉你如何在没有冒充的情况下完成它吗?谢谢! – Serhiy 2011-11-04 13:57:22