【问题标题】:IIS slow in loading Report ViewerIIS 加载报告查看器很慢
【发布时间】:2016-10-18 00:01:48
【问题描述】:

我们在同一台生产服务器上运行 IIS 和 SSRS,并且有两种类型的报告 - 一种通过 Report Viewer 运行,连接到 SSRS(远程模式),另一种调用 SSRS Web 服务来生成 PDF。

对于这两种报告类型,加载页面时会变得非常慢,需要 20 秒以上。在服务器负载较重的时期最为明显,在 IIS 中回收应用程序池后缓慢会消失,但一段时间后会恢复(应用程序池设置为每天凌晨 3 点回收)。

我检查了 SSRS 的执行日志 - 对于所有报告,数据检索 + 处理 + 渲染的时间不会超过 2 秒,并且 SSRS 的 http 日志表明页面变为时没有来自 IIS 的请求无响应 - 一旦请求到达,它会很快加载。 通过报表管理器运行的报表也非常快。

SSRS 似乎不是这里的罪魁祸首,似乎是 IIS 中的某些东西导致了它。

有没有其他人遇到过类似的问题,或者可以为我指出正确的诊断方向?

非常感谢。


报告查看器:

public abstract class ReportPageBase : System.Web.UI.Page
{
    protected void GenerateReport(ReportViewer reportViewer)
    {
        var reportParameters = new List<ReportParameter>();

        reportViewer.Visible = true;

        reportViewer.ServerReport.ReportServerUrl = new Uri(Util.ReportServerUrl);
        reportViewer.ServerReport.ReportServerCredentials = new ReportServerCredentials();

        ParametersOverride(ref reportParameters);
        reportViewer.ServerReport.SetParameters(reportParameters);
    }

    protected abstract void ParametersOverride(ref List<ReportParameter> reportParameters);
}

网络服务:

public static class ReportExporter
{
    public static Stream GetExportStream(string reportName, string format, ReportExecutionService.ParameterValue[] paramVals)
    {
        var rs = new ReportingService2005SoapClient();
        var rsExec = new ReportExecutionServiceSoapClient();

        var username = ConfigurationManager.AppSettings["ReportViewerUser"];
        var password = ConfigurationManager.AppSettings["ReportViewerPassword"];
        var domain = ConfigurationManager.AppSettings["ReportViewerDomain"];
        var folderPath = ConfigurationManager.AppSettings["ReportViewerFoler"];
        System.Net.NetworkCredential networkCredential = new System.Net.NetworkCredential(username, password, domain);

        rs.ClientCredentials.Windows.ClientCredential = networkCredential;
        rsExec.ClientCredentials.Windows.ClientCredential = networkCredential;

        rs.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
        rsExec.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;

        var _reportName = (folderPath ?? @"/") + reportName.Trim();

        string historyID = null;

        // gets the parameters
        rs.GetReportParameters(_reportName, historyID, forRendering, values, credentials, out parameters);

        // load the report
        ExecutionInfo executionInfo = null;
        ReportExecutionService.ServerInfoHeader serverInfoHeader = null;

        ExecutionHeader header = new ExecutionHeader();
        rsExec.LoadReport(null, _reportName, historyID, out serverInfoHeader, out executionInfo);
        header.ExecutionID = executionInfo.ExecutionID;

        rsExec.SetExecutionParameters(header, null, paramVals, "en-us", out executionInfo);

        byte[] result = null;
        string[] streamIds = null;
        string encoding = String.Empty;
        string mimeType = String.Empty;
        string extension = String.Empty;
        ReportExecutionService.Warning[] warnings = null;

        rsExec.Render(header,
                      null,
                      format,
                      null,
                      out result,
                      out extension,
                      out mimeType,
                      out encoding,
                      out warnings,
                      out streamIds);

        var memstream = new MemoryStream(result);

        return memstream;
    }
}

【问题讨论】:

  • 我们也有类似的问题。你找到什么了吗?
  • @RonnyElfleinr11lein 不,很遗憾。

标签: c# iis reporting-services reportviewer


【解决方案1】:

就我而言。 IIS Express 非常快。但是在 IIS 8.5 中慢得不能接受! 我的解决方案:

  • 创建一个新的应用程序池,例如。 “.NET CLR 版本 v4.0.30319”、“经典”
  • 在 Web 中将应用程序池更改为新的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多