【问题标题】:SSRS rendered report in MVC causing a 404 errorSSRS 在 MVC 中呈现报告导致 404 错误
【发布时间】:2021-01-07 03:02:10
【问题描述】:

在从我们的 SSRS 呈现 pdf 报告时,我遇到了一个问题,请参见下文。我试图研究不同的来源,但到目前为止没有任何效果。

Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.MissingEndpointException: 'The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version.'

我有这行代码应该可以工作:

var parameters = new List<ReportParameter>
{ 
    new ReportParameter("paramter_1", "paramter_1_value"), 
};
var reportServerUrl = ConfigurationManager.AppSettings["ReportServerUrl"];
reportViewer.ServerReport.ReportServerUrl = new Uri(reportServerUrl);
reportViewer.ServerReport.ReportPath = '/ReportFolder/ReportName';
reportViewer.ServerReport.ReportServerCredentials = new CustomCredentials();
reportViewer.ServerReport.SetParameters(parameters);
reportViewer.ServerReport.Refresh();

var mimeType = "";
var encoding = "";
var filenameExtension = "pdf";
string[] streamids = null;
Warning[] warnings = null;
var outputFileName = "File_Name.pdf";
var bytes = reportViewer.ServerReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
var pdfReport = File(bytes, "application/pdf", outputFileName);

我在这里做错了吗?

【问题讨论】:

    标签: c# asp.net-mvc reporting-services ssrs-2012


    【解决方案1】:

    您可以尝试一些事情:

    1. 尝试从您尝试访问报告的服务器 ping 服务器,看看您是否可以访问它。如果您无法通过 ping 访问它。如果您无法 ping 它,则可能是防火墙的问题。 ping 可能在服务器上被禁用,因此请确保不是这种情况。事实上,如果您无法从代码访问报表服务器,您将无法运行报表。
    2. 确保您用于 ReportServerUrl 的路径与安装报表服务器的计算机上的报表服务器配置管理器中配置的路径相同。
    3. 确保已安装证书。检查此链接:https://blog.jpries.com/2017/02/11/troubleshooting-error-404-error-400-or-invalid-request-or-bad-connection-in-a-new-ssrs-installation/

    【讨论】:

      【解决方案2】:

      对于任何可能遇到这种情况的人来说,这是一个愚蠢的错误。我一直在使用http://server/reports,它用于在网络上打开报告。

      您可能需要检查报表服务器配置管理器并确保使用指向已配置虚拟路径的 URL。也就是说,虚拟路径是reportserver,您必须将其用作您的 ReportServerUrl 才能呈现报告。

      reportViewer.ServerReport.ReportServerUrl = new Uri("http://server/reportserver");

      【讨论】:

        猜你喜欢
        • 2013-06-06
        • 1970-01-01
        • 1970-01-01
        • 2013-06-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-06-24
        • 1970-01-01
        相关资源
        最近更新 更多