报告查看器控件(Web)显示空白报告

时间:2021-10-06 08:20:01

I have a web form containing a ReportViewer control, a DIV element so I can see that the page actually renders. I see that my page properly loads, I see the report service being accessed in Fiddler, but there is never anything displayed.

我有一个包含ReportViewer控件的Web表单,一个DIV元素,所以我可以看到页面实际渲染。我看到我的页面正确加载,我看到在Fiddler中访问报表服务,但是从未显示过任何内容。

At present, I'm using a report with static text, no queries on it, in order to ensure that I isolate the issue.

目前,我正在使用带有静态文本的报告,对其没有任何疑问,以确保我将问题隔离开来。

My page is as follows:

我的页面如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReportViewer.aspx.cs" Inherits="PeopleNet.Web.Views.Reports.ReportViewer" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Path="~/scripts/jquery-1.7.2.js" />
                <asp:ScriptReference Path="~/scripts/fixReportViewer.js" />
            </Scripts>
        </asp:ScriptManager>

        <div>
            This is the report viewer page...
        </div>
        <rsweb:ReportViewer ID="ReportViewer1" runat="server"></rsweb:ReportViewer>
    </form>
</body>
</html>

The code to display the report is:

显示报告的代码是:

protected void Page_Load(object sender, EventArgs e)
{
    this.ReportViewer1.ServerReport.ReportServerUrl = ConfigurationFacade.ReportServerUri;
    this.ReportViewer1.ServerReport.ReportPath = { path to report name };
    this.ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials(); // custom class implementing IReportServerCredentials as described in various places around the web, including SO
    this.ReportViewer1.ServerReport.Refresh();
}

My web.config file is configured with the HttpHandlers as required:

我的web.config文件根据需要配置了HttpHandlers:

<system.web>
    <!-- abbreviated... -->
    <httpHandlers>
        <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false" />
    </httpHandlers>
</system.web>

And :

而且:

<system.webServer>
    <!-- abbreviated... -->
    <handlers>
        <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </handlers>
</system.webServer>

The server runs Windows 2008 and SQL Server 2008 R2.

服务器运行Windows 2008和SQL Server 2008 R2。

I am using the SQL Server 2012 version of the viewer, as we are in the process of updating our environments to 2012.

我正在使用SQL Server 2012版本的查看器,因为我们正在将环境更新到2012。

I have repeatedly verified that the report is accessible from the ReportManager, with no issues whatsoever.

我已经多次验证报告可以从ReportManager访问,没有任何问题。

I have been attempting to access this in IE9, having seen various issues stated with other browsers.

我一直试图在IE9中访问它,看过其他浏览器中陈述的各种问题。

I am presently (for testing only) passing my credentials as the report server credentials. I am a Reporting Services Administrator, as well as a member of the server administrators group on the server.

我目前(仅用于测试)将我的凭据作为报表服务器凭据传递。我是Reporting Services管理员,也是服务器上服务器管理员组的成员。

I have checked both the event log and the ReportServerService log, and have found nothing amiss.

我已经检查了事件日志和ReportServerService日志,并且没有发现任何错误。

UPDATE: Looks like when change the AsyncRendering to false, and ensure that I don't try to "SetParameters" with an empty collection, this gets mostly cleared up:

更新:看起来当将AsyncRendering更改为false并确保我不尝试使用空集合的“SetParameters”时,这大部分都会被清除:

this.ReportViewer1.AsyncRendering = false;

What am I missing in the configuration/code here?

我在配置/代码中缺少什么?

5 个解决方案

#1


3  

My solution to this issue was related to trying to set the report viewer height to 100%. This resulted in no report showing. Changing the height to a px value (ie 900px) got the reportviewer working.

我对此问题的解决方案与尝试将报表查看器高度设置为100%有关。这导致没有报告显示。将高度更改为px值(即900px)使reportviewer正常工作。

#2


1  

There is this blog entry on MSDN that discusses how asynchronous rendering works.

MSDN上有一篇博客文章讨论了异步呈现的工作原理。

Additionally, it mentions that (as was said in the comments) synchronous rendering embeds the content in the page, while asynchronous rendering renders the content in a frame. The size of the frame is "difficult...to calculate" and the SizeToReportContent property is ignored.

此外,它提到(如评论中所述)同步呈现将内容嵌入页面中,而异步呈现则在帧中呈现内容。框架的大小“难以计算”,并忽略SizeToReportContent属性。

Since your report won't display unless it is synchronously rendered, the issue must be in the use of frames.

由于除非同步呈现报告,否则不会显示报告,因此问题必须在于使用框架。

In the article mentioned in the comments, asynchronously rendering the report will collapse the control height to zero pixels if a relative height is used. This could explain why nothing is displayed. You might try specifying a height for the control. There are other suggestions in that article as well.

在评论中提到的文章中,如果使用相对高度,异步渲染报表会将控件高度折叠为零像素。这可以解释为什么没有显示。您可以尝试为控件指定高度。该文章中还有其他建议。

That's assuming that your issue is in the SQL Server 2008 R2 SSRS version, which I believe draws from VS 2008. SQL Server 2012 SSRS I think draws on VS 2010, which is not supposed to have those issues, so when you finish your upgrade, this issue might go away.

这是假设你的问题是在SQL Server 2008 R2 SSRS版本中,我相信它来自VS 2008. SQL Server 2012 SSRS我认为借鉴VS 2010,这不应该有这些问题,所以当你完成升级时,这个问题可能会消失。

#3


1  

I had exactly the same symptom: A report was rendered with a completely blank page. For me that was the case in production, but it worked in development environment.

我有完全相同的症状:报告呈现完全空白的页面。对我来说就是生产中的情况,但它在开发环境中起作用。

The report had two parameters and in the RDL both without having default values specified. When calling the report in the aspx code behind I had accidentally passed only one parameter. The second parameter had a default value set on the Report Server of the development machine but not in production. (Yes, the Report Server allows to specify parameter defaults independently from the default settings in the RDL file.) As a result the report rendered in development but not in production.

该报告有两个参数,在RDL中都没有指定默认值。在后面的aspx代码中调用报表时,我不小心只传递了一个参数。第二个参数在开发计算机的报表服务器上设置了默认值,但未在生产中设置。 (是的,报表服务器允许独立于RDL文件中的默认设置指定参数默认值。)因此,报表在开发中呈现但未在生产中呈现。

I found this by looking at the response XML with Fiddler. It contained an element telling me that a parameter value was invalid. Unfortunately the Report Viewer itself doesn't show any error message about the missing parameter and just displays a blank page - which makes the root of the problem difficult to find.

我通过查看Fiddler的响应XML找到了这个。它包含一个元素,告诉我参数值无效。遗憾的是,报告查看器本身不会显示有关缺少参数的任何错误消息,只显示空白页面 - 这使得难以找到问题的根源。

#4


0  

My report was showing blank as well. I played with the properties and it finally showed up.

我的报告也显示空白。我玩了这些属性,最终出现了。

Changing the ProcessingMode property on the ReportViewer control in the aspx page worked for me:

在aspx页面中更改ReportViewer控件上的ProcessingMode属性对我有用:

<rsweb:ReportViewer ID="ReportViewer1" runat="server" 
    Width="100%"  ProcessingMode="Remote">
</rsweb:ReportViewer>

This is what I have:

这就是我所拥有的:

<rsweb:ReportViewer ID="ReportViewer1" runat="server" ZoomMode="PageWidth"
    Font-Names="Verdana" Font-Size="8pt" Width="100%" ProcessingMode="Remote"
    ShowParameterPrompts="False" ShowToolBar="True"  ShowCredentialPrompts="False" 
    ShowFindControls="False" ShowZoomControl="False" CssClass="ReportViewer">
</rsweb:ReportViewer>

web.config:

web.config中:

<configuration>
  <connectionStrings>
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <system.web>

    <httpHandlers>
      <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
    </httpHandlers>

    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
      </assemblies>
    </compilation>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
    </authentication>
    <membership>
      <providers>
...
      </providers>
    </roleManager>
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <handlers>
      <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </handlers>
  </system.webServer>
</configuration>

#5


0  

There are several problems when you get blank reports:

当您收到空白报告时有几个问题:

  1. IIS Pipeline; IIS 6 vs IIS7 and above Make sure you have correctly registerd HttpHandler
  2. IIS管道; IIS 6与IIS7及更高版本确保您已正确注册HttpHandler

IIS7 settings

IIS7设置

    <system.webServer>
    <handlers>
      <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </handlers>

More details

更多细节

If missed the correct registration you can try to switch IIS application pool into Classic mode 报告查看器控件(Web)显示空白报告

如果错过了正确的注册,您可以尝试将IIS应用程序池切换到经典模式

If your registration is Ok you should be able to use Integrated mode

如果您的注册确定,您应该能够使用集成模式

  1. Another Handler interferes with ReportViewer
  2. 另一个处理程序干扰ReportViewer

In my case it was Glimpse. Glimpse is a very powerful tool and it works fine together with ReporViewer on developer machine but it has problems on deployed customer server. Solution was easy, jst remove all glimse settings from web.config

就我而言,这是Glimpse。 Glimpse是一个非常强大的工具,它与开发人员机器上的ReporViewer一起工作正常,但它在部署的客户服务器上存在问题。解决方案很简单,jst从web.config中删除所有glimse设置

#1


3  

My solution to this issue was related to trying to set the report viewer height to 100%. This resulted in no report showing. Changing the height to a px value (ie 900px) got the reportviewer working.

我对此问题的解决方案与尝试将报表查看器高度设置为100%有关。这导致没有报告显示。将高度更改为px值(即900px)使reportviewer正常工作。

#2


1  

There is this blog entry on MSDN that discusses how asynchronous rendering works.

MSDN上有一篇博客文章讨论了异步呈现的工作原理。

Additionally, it mentions that (as was said in the comments) synchronous rendering embeds the content in the page, while asynchronous rendering renders the content in a frame. The size of the frame is "difficult...to calculate" and the SizeToReportContent property is ignored.

此外,它提到(如评论中所述)同步呈现将内容嵌入页面中,而异步呈现则在帧中呈现内容。框架的大小“难以计算”,并忽略SizeToReportContent属性。

Since your report won't display unless it is synchronously rendered, the issue must be in the use of frames.

由于除非同步呈现报告,否则不会显示报告,因此问题必须在于使用框架。

In the article mentioned in the comments, asynchronously rendering the report will collapse the control height to zero pixels if a relative height is used. This could explain why nothing is displayed. You might try specifying a height for the control. There are other suggestions in that article as well.

在评论中提到的文章中,如果使用相对高度,异步渲染报表会将控件高度折叠为零像素。这可以解释为什么没有显示。您可以尝试为控件指定高度。该文章中还有其他建议。

That's assuming that your issue is in the SQL Server 2008 R2 SSRS version, which I believe draws from VS 2008. SQL Server 2012 SSRS I think draws on VS 2010, which is not supposed to have those issues, so when you finish your upgrade, this issue might go away.

这是假设你的问题是在SQL Server 2008 R2 SSRS版本中,我相信它来自VS 2008. SQL Server 2012 SSRS我认为借鉴VS 2010,这不应该有这些问题,所以当你完成升级时,这个问题可能会消失。

#3


1  

I had exactly the same symptom: A report was rendered with a completely blank page. For me that was the case in production, but it worked in development environment.

我有完全相同的症状:报告呈现完全空白的页面。对我来说就是生产中的情况,但它在开发环境中起作用。

The report had two parameters and in the RDL both without having default values specified. When calling the report in the aspx code behind I had accidentally passed only one parameter. The second parameter had a default value set on the Report Server of the development machine but not in production. (Yes, the Report Server allows to specify parameter defaults independently from the default settings in the RDL file.) As a result the report rendered in development but not in production.

该报告有两个参数,在RDL中都没有指定默认值。在后面的aspx代码中调用报表时,我不小心只传递了一个参数。第二个参数在开发计算机的报表服务器上设置了默认值,但未在生产中设置。 (是的,报表服务器允许独立于RDL文件中的默认设置指定参数默认值。)因此,报表在开发中呈现但未在生产中呈现。

I found this by looking at the response XML with Fiddler. It contained an element telling me that a parameter value was invalid. Unfortunately the Report Viewer itself doesn't show any error message about the missing parameter and just displays a blank page - which makes the root of the problem difficult to find.

我通过查看Fiddler的响应XML找到了这个。它包含一个元素,告诉我参数值无效。遗憾的是,报告查看器本身不会显示有关缺少参数的任何错误消息,只显示空白页面 - 这使得难以找到问题的根源。

#4


0  

My report was showing blank as well. I played with the properties and it finally showed up.

我的报告也显示空白。我玩了这些属性,最终出现了。

Changing the ProcessingMode property on the ReportViewer control in the aspx page worked for me:

在aspx页面中更改ReportViewer控件上的ProcessingMode属性对我有用:

<rsweb:ReportViewer ID="ReportViewer1" runat="server" 
    Width="100%"  ProcessingMode="Remote">
</rsweb:ReportViewer>

This is what I have:

这就是我所拥有的:

<rsweb:ReportViewer ID="ReportViewer1" runat="server" ZoomMode="PageWidth"
    Font-Names="Verdana" Font-Size="8pt" Width="100%" ProcessingMode="Remote"
    ShowParameterPrompts="False" ShowToolBar="True"  ShowCredentialPrompts="False" 
    ShowFindControls="False" ShowZoomControl="False" CssClass="ReportViewer">
</rsweb:ReportViewer>

web.config:

web.config中:

<configuration>
  <connectionStrings>
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <system.web>

    <httpHandlers>
      <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
    </httpHandlers>

    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
      </assemblies>
    </compilation>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
    </authentication>
    <membership>
      <providers>
...
      </providers>
    </roleManager>
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <handlers>
      <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </handlers>
  </system.webServer>
</configuration>

#5


0  

There are several problems when you get blank reports:

当您收到空白报告时有几个问题:

  1. IIS Pipeline; IIS 6 vs IIS7 and above Make sure you have correctly registerd HttpHandler
  2. IIS管道; IIS 6与IIS7及更高版本确保您已正确注册HttpHandler

IIS7 settings

IIS7设置

    <system.webServer>
    <handlers>
      <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </handlers>

More details

更多细节

If missed the correct registration you can try to switch IIS application pool into Classic mode 报告查看器控件(Web)显示空白报告

如果错过了正确的注册,您可以尝试将IIS应用程序池切换到经典模式

If your registration is Ok you should be able to use Integrated mode

如果您的注册确定,您应该能够使用集成模式

  1. Another Handler interferes with ReportViewer
  2. 另一个处理程序干扰ReportViewer

In my case it was Glimpse. Glimpse is a very powerful tool and it works fine together with ReporViewer on developer machine but it has problems on deployed customer server. Solution was easy, jst remove all glimse settings from web.config

就我而言,这是Glimpse。 Glimpse是一个非常强大的工具,它与开发人员机器上的ReporViewer一起工作正常,但它在部署的客户服务器上存在问题。解决方案很简单,jst从web.config中删除所有glimse设置