我试图通过在单击按钮时将其重定向到包含ReportViewer控件的.aspx文件,来测试从托管浏览器中的报告的服务器加载SSRS报告。
<rsweb:ReportViewer ID="ReportViewer1" runat="server"></rsweb:ReportViewer>在.aspx文件的后端,我添加了以下内容:
 ReportViewer1.ProcessingMode = ProcessingMode.Remote;
 IReportServerCredentials irsc = new ReportServerCredentials("username", "password", "domain");
 ReportViewer1.ServerReport.ReportServerCredentials = irsc;
 ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://domain/ReportServer/ReportViewer.aspx");
 ReportViewer1.ServerReport.ReportPath = "/Report/path";
 ReportViewer1.ServerReport.SetParameters(new ReportParameter[] {
     new ReportParameter("param1", "sample1"),
     new ReportParameter("param2", "sample2")
 });
 ReportViewer1.ServerReport.Refresh();'ReportServerCredentials‘类是一个实现IReportServerCredentials的类。
我尝试使用用户名和密码使用浏览器连接到指定的域,并在指定的'ReportPath‘中查看报告,并验证我是否可以成功访问和查看报告。
但是,当程序运行并使用此方法时:
ReportViewer1.ServerReport.SetParameter出现以下错误:
Client found response content type of '', but expected 'text/xml'.
The request failed with an empty response.导致此问题的原因是什么?
发布于 2017-10-17 14:46:19
这个错误实际上告诉我ReportServerUrl是错的。在我的情况下,而不是
http://domain/ReportServer/ReportViewer.aspx?我实际上应该使用
http://domain/ReportServer错误在那之后消失了,因为它能够连接到报告。但是,由于.aspx文件的问题,没有显示任何内容。未将文件的UI内容加载到页面中,这导致页面为空。
https://stackoverflow.com/questions/46764099
复制相似问题