MVC 错误中的 s-s-rS 报告查看器 (ReportViewerForMVC)

Posted

技术标签:

【中文标题】MVC 错误中的 s-s-rS 报告查看器 (ReportViewerForMVC)【英文标题】:s-s-rS report viewer in MVC Error (ReportViewerForMVC) 【发布时间】:2018-09-18 20:58:34 【问题描述】:

我正在尝试在我的 MVC 应用程序中包含 s-s-rS (.rdl)。它总是给我错误:

The WebResource.axd handler must be registered in the configuration to process this request.

<!-- Web.Config Configuration File -->

<configuration>
   <system.web>
       <httpHandlers>
           <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="True" />
       </httpHandlers>
   </system.web>
</configuration>

我已经安装了

Microsoft.Report.Viewer v. 11.0.0
Microsoft.ReportingServices.ReportViewerControl.WebForms 14.1000.523
ReportViewerForMVC

这是我的代码:

ReportViewer reportViewer = new ReportViewer();
                reportViewer.ProcessingMode = ProcessingMode.Local;
                reportViewer.SizeToReportContent = true;
                reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Areas\Daleel.HRIS\Reports\DailyAttendance.rdl";
                reportViewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", data));

                ViewBag.ReportViewer = reportViewer;

查看:

@using ReportViewerForMvc;
<div class="ui attached very relaxed segment">
    <div class="ui container">

        @html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)

    </div>
</div>

WEB配置:

  <system.web>
    <trace enabled="false" />

    <httpRuntime targetFramework="4.6" waitChangeNotification="0" maxWaitChangeNotification="0" maxRequestLength="1048576" />
    <compilation>
      <buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
      </buildProviders>
      <assemblies>
        <add assembly="Microsoft.ReportViewer.Common, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
        <add assembly="Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
      </assemblies>
    </compilation>
    <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>
  <system.webServer>
<handlers>
      <clear />
      <add name="StaticFile" path="*" verb="*" type="" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" scriptProcessor="" resourceType="Either" requireAccess="Read" allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
      <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>
    <validation validateIntegratedModeConfiguration="false" />    
  </system.webServer>

谁能帮我解决这个问题?

【问题讨论】:

【参考方案1】:

您是否完成了错误消息要求您执行的操作? 在 web.config 中添加处理程序

【讨论】:

看起来它在错误的部分, 不在 两个地方都有 谁能建议这个错误,我也面临这个问题@Html.ReportViewer not found。

以上是关于MVC 错误中的 s-s-rS 报告查看器 (ReportViewerForMVC)的主要内容,如果未能解决你的问题,请参考以下文章

在 ASP.net MVC 站点中查看 s-s-rS 报告

s-s-rS - 报告后上传数据源

s-s-rS 报告查看器 + ASP.NET 凭据 401 异常

s-s-rS 报告管理器未正确显示

报告参数的日期时间格式问题,在 s-s-rS 报告 Web 服务中,而不是报告查看器控件

s-s-rS 错误 - 请求失败,响应为空