我正在运行报表服务器(SSRS),并从ASP应用程序中调用报表。每当我试图通过网站本身加载报告时,它都会显示一个HTTP 401错误,无论是在本地还是通过域访问。如果我在ReportServer中打开报告,我可以很好地打开它们,问题是通过网页加载。我尝试更改数据源本身的凭据,但一切都很好,切换了SQL用户凭据和Windows身份验证,但没有任何帮助。任何帮助都将不胜感激,因为我不知道该怎么办。
这是本地服务器错误:
[WebException: The request failed with HTTP status 401: Unauthorized.]
Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.GetSecureMethods() +232
Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.IsSecureMethod(String methodname) +60
Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.SetConnectionSSLForMethod(String methodname) +16
Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.ProxyMethodInvocation.Execute(RSExecutionConnection connection, ProxyMethod`1 initialMethod, ProxyMethod`1 retryMethod) +831
Microsoft.Reporting.WebForms.SoapReportExecutionService.LoadReport(String report, String historyId) +34
Microsoft.Reporting.WebForms.ServerReport.EnsureExecutionSession() +175
Microsoft.Reporting.WebForms.ServerReport.SetParameters(IEnumerable`1 parameters) +162
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178
ASPX代码隐藏:
ReportViewer1.ServerReport.ReportServerUrl = new System.Uri("serveradress");
ReportViewer1.ServerReport.ReportPath = "/TrialBalance";
Microsoft.Reporting.WebForms.ReportParameter[] Param = new Microsoft.Reporting.WebForms.ReportParameter[1];
Param[0] = new Microsoft.Reporting.WebForms.ReportParameter("ID", Convert.ToString(Session["BranchID"]));
ReportViewer1.ShowParameterPrompts = false;
ReportViewer1.ServerReport.SetParameters(Param);
ReportViewer1.ServerReport.Refresh();
尝试1)授予AppPool LocalSystem权限
2) 我可以使用domain.com/Reportserver或localhost/Reportserver访问Reportserver,问题只发生在ASP应用程序中。
3) 已验证SSRS服务帐户权限。
4) DataSource连接时没有问题。
5) 一周前,报告工作正常,我将一个服务器映像迁移到另一个功能更强大的服务器,我相信这是因为它坏了,但我不知道映像是怎么回事。一切都没有改变。
6) 我可以调用本地开发计算机中的ReportServer(Report Loads和all),它针对远程服务器。如果我在网站中访问相同的ASPX,它会给我HTTP 401错误
7) 在编程中更改为直接针对localhost。。。这就是错误:
An error has occurred during report processing. (rsProcessingAborted)
Cannot create a connection to data source 'DataSource1'. (rsErrorOpeningConnection)
Cannot open database "CoopBranches" requested by the login. The login failed. Login failed for user 'NT AUTHORITYSYSTEM'.
这很奇怪,因为我正在测试数据源,它的连接没有任何问题。
几天前我遇到了同样的问题,下面是一些基于我的建议。
- 在您的应用程序池中,尝试指示/模拟域用户,然后在服务器上授予该报告权限
- 这一次有很大的不同。试着看看ReportViewer1正在解析为什么,我注意到如果您的应用程序转到
http://{YourReportServerURL}/ReportServer/Pages/ReportViewer.aspx/{YourReportName}&{Param1}={ParamValue}
然后,您将遇到多跳身份验证问题,因为URL重定向到另一个最终解决的URL,在不使用Kerberos 的过程中失去了经过身份验证的用户
http://{YourReportServerURL}/ReportServer/{YourReportFolder}/{Your ReportName}&{Param1}={ParamValue}
如果是这种情况,尝试像这样的手动生成URL
http://{YourReportServerURL}/ReportServer/{YourReportFolder}/{Your ReportName}&{Param1}={ParamValue}