2

我正在尝试在我的 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>

网络配置:

  <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>

谁能帮我解决这个问题?

4

1 回答 1

0

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

于 2018-04-09T12:50:23.657 回答