MVC错误中的SSRS报告查看器(ReportViewerForMVC)

时间:2018-04-09 12:45:46

标签: asp.net asp.net-mvc asp.net-mvc-5 reportingservices-2005 reportviewerformvc

我试图在我的MVC应用程序中包含SSRS(.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>

WEbconfig:

  <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 个答案:

答案 0 :(得分:0)

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