ActiveReports 报表:部署常见错误以及配置HttpHandler

发布时间:2014/12/01 00:12 发布者:iceman

返回博客中心

 

ActiveReports 报表的 WebViewer 控件已经发布了相当长一段时间,它可以使你在浏览器中所见即所得的浏览报表。在发布之后,我们在功能和性能方法都做了很多增强,目前在 ActiveReports 9中,WebViewer 提供了多种不同的浏览方式:RawHtml,Html,Acrobat Reader 和 FlashViewer。

一个比较常见的问题是,在开发机器上WebViewer可以正常加载并浏览报表,但是一旦部署就会出现WebViewer不渲染或者抛出其他错误信息,本文总结了常见的错误信息,如下:

  • “OpenedReport is undefined”

UndefinedError

上图错误时设置WebViewer的浏览类型为“FlashViewer” 时发生。

  • “ViewerViewModel is undefined”
    上图错误时设置WebViewer的浏览类型为“Acrobat Reader”  时发生。
  • “IOError while loading document. Reason: Error #2032″

FlashViewerError

 

以上错误都是一个共同原因导致的,那就是处理程序映射没有正确添加。

理解处理程序映射

添加 WebViewer 控件到 ASPX 页面时,“GrapeCity.ActiveReports.Web.v8.dll” 会自动添加到工程中。WebViewer 需要的前端 JavaScript 资源就包含在这个DLL中。如果页面没有正确加载任何一个前端资源,之前提高的问题就会发生。当浏览类型为 “HtmlViewer” 时,工具条也不会正确加载。

MSDN 中,针对 HttpHandlers的解释,请参考链接:“http://msdn.microsoft.com/en-us/library/aa903367(v=vs.71).aspx以下是在 WebViewer没有正常加载时  FireBug 抓取到的错误信息:

ScriptCalls

 

正如在图片中看到的,所有扩展名为 “.ar9″ 的文件都不是标准的扩展类型。HttpHandler的作用是正引导这些需求指向正确的DLL。但是,这些映射必须提前添加到 WebConfig 文件中或手动添加到IIS的映射列表中。

配置处理程序映射

Integrated 模式:

    <httpHandlers>
      <add verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
      <add verb="*" path="*.ar9" type="GrapeCity.ActiveReports.Web.Handlers.ReportBinariesStreamer, GrapeCity.ActiveReports.Web.v9, Version=9.0.1678.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
      <add verb="*" path="*.ActiveReport" type="GrapeCity.ActiveReports.Web.Handlers.CompiledReportHandler, GrapeCity.ActiveReports.Web.v9, Version=9.0.1678.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
      <add verb="*" path="*.rpx" type="GrapeCity.ActiveReports.Web.Handlers.RpxHandler, GrapeCity.ActiveReports.Web.v9, Version=9.0.1678.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
      <add verb="*" path="*.rdl,*.rdlx" type="GrapeCity.ActiveReports.Web.Handlers.RdlxHandler, GrapeCity.ActiveReports.Web.v9, Version=9.0.1678.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
      <add verb="*" path="*.ar9Web" type="GrapeCity.ActiveReports.Web.Handlers.WebCacheAccessHandler, GrapeCity.ActiveReports.Web.v9, Version=9.0.1678.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" />
    </httpHandlers>

 

    <handlers>
      <add verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" name="AsmxHandler" resourceType="Unspecified" preCondition="integratedMode" />
      <add verb="*" path="*.ar9" type="GrapeCity.ActiveReports.Web.Handlers.ReportBinariesStreamer, GrapeCity.ActiveReports.Web.v9, Version=9.0.1678.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" name="AR9_ReportBinariesStreamer" resourceType="Unspecified" preCondition="integratedMode" />
      <add verb="*" path="*.ActiveReport" type="GrapeCity.ActiveReports.Web.Handlers.CompiledReportHandler, GrapeCity.ActiveReports.Web.v9, Version=9.0.1678.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" name="AR9_CompiledReportHandler" resourceType="Unspecified" preCondition="integratedMode" />
      <add verb="*" path="*.rpx" type="GrapeCity.ActiveReports.Web.Handlers.RpxHandler, GrapeCity.ActiveReports.Web.v9, Version=9.0.1678.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" name="AR9_RpxHandler" resourceType="Unspecified" preCondition="integratedMode" />
      <add verb="*" path="*.rdl,*.rdlx" type="GrapeCity.ActiveReports.Web.Handlers.RdlxHandler, GrapeCity.ActiveReports.Web.v9, Version=9.0.1678.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" name="AR9_RdlxHandler" resourceType="Unspecified" preCondition="integratedMode" />
      <add verb="*" path="*.ar9Web" type="GrapeCity.ActiveReports.Web.Handlers.WebCacheAccessHandler, GrapeCity.ActiveReports.Web.v9, Version=9.0.1678.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff" name="AR9_WebCacheAccessHandler" resourceType="Unspecified" preCondition="integratedMode" />
    </handlers>

 

WebConfig示例:

 

更多ActiveReports报表功能请参考:/developer/activereports


关于葡萄城

赋能开发者!葡萄城是专业的集开发工具、商业智能解决方案、低代码开发平台于一身的软件和服务提供商,为超过 75% 的全球财富 500 强企业提供服务。葡萄城专注控件软件领域30年,希望通过模块化的开发控件、灵活的低代码应用开发平台等一系列开发工具、解决方案和服务,帮助开发者快速响应复杂多变的业务需求,最大程度地发挥开发者的才智和潜能,让开发者的 IT 人生更从容更美好。

了解详情,请访问葡萄城官网