none
Report viewer MVC 3 Configuration Error RRS feed

  • Question

  •  

     

    I put an aspx page with a Report Viewer 10 Control in an MVC 3 application.

    I get the following error.  I added and then removed a button, to test postback and it works fine.  Any idea how to fix the report viewer error message?

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SrReport.aspx.cs" Inherits="Wits.Areas.SR.Reports.SrReport" %>
     
    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <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">
        </asp:ScriptManager>
        <div>
         <rsweb:ReportViewer ID="ReportViewer1" runat="server">
        </rsweb:ReportViewer>
        </div>
        </form>
       
    </body>
    </html>

     

     

    Report Viewer Configuration Error

    The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file. Add <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> to the system.web/httpHandlers section of the web.config file, or add <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" /> to the system.webServer/handlers section for Internet Information Services 7 or later.

     

        <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>
      </system.web>
      <system.webServer>
        <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>

     

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

    • Edited by chuck02323 Wednesday, November 2, 2011 8:57 PM
    Wednesday, November 2, 2011 8:26 PM

Answers

  • Added

        <buildProviders>
            <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
          </buildProviders>

     

     

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

     

    Now it works

     

    • Marked as answer by chuck02323 Wednesday, November 2, 2011 9:03 PM
    Wednesday, November 2, 2011 9:03 PM

All replies

  • I have read that the Reportviewer depends on ViewState, so must be hosted in webforms.
    I host the reportViewer in a regular Webforms Page in the MVC3 app, in a folder I arbitrarily named Reports.
    Then I bypass routing for that folder name, using the following in global.asax
    public static void RegisterRoutes(RouteCollection routes)
            {
                routes.IgnoreRoute("Reports/");  //Reports Viewers depend on Viewstate so are hosted in class ASPX web forms, so bypassing MVC3 routing
                routes.MapRoute(
                    "Default", // Route name
                    "{controller}/{action}/{id}", // URL with parameters
                    new { controller = "Account", action = "Logon", id = UrlParameter.Optional } // Parameter defaults
                );
            }
    
    
    
    Then in the global.asax in the Application_Start event, I add:
     RegisterRoutes(RouteTable.Routes);
    
    You also need to reference
    Microsoft.Reportviewer.Common and Microsoft.ReportViewer.WebForms
    <compilation debug="true" targetFramework="4.0">
          <assemblies>
            <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
            <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"/>
    In web.Config look for
    <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"/>
    and
    <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>

    and

     

     <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <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>

    and

     

    <buildProviders>
            <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
          </buildProviders>
        </compilation>

     

     

     

    in




    just david
    • Edited by just david Wednesday, November 2, 2011 8:48 PM
    Wednesday, November 2, 2011 8:43 PM
  • That's interesting but, I don't think it applies to my problem.

    I have no trouble getting to the page in MVC.  I just get the error.

    My page is an area so I use MapPageRoute:

           public override void RegisterArea(AreaRegistrationContext context)
            {
     
     
                //Custom route for reports
                context.Routes.MapPageRoute(
                 "SrReports",                         // Route name
                 "SR/Reports/{reportname}",             // URL
                 "~/Areas/SR/Reports/SrReport.aspx"   // File
                 );
    Wednesday, November 2, 2011 8:50 PM
  • Added

        <buildProviders>
            <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
          </buildProviders>

     

     

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

     

    Now it works

     

    • Marked as answer by chuck02323 Wednesday, November 2, 2011 9:03 PM
    Wednesday, November 2, 2011 9:03 PM