Report Viewer Configuration error - In View Source

2020-03-10 04:56发布

问题:

I found the following error message when I checked View source of the web page , but the web page works just fine. Our Test lead found the error while performing Assertion tests.

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

Why is this error message coming up in view source..

Note: There is a div tag around this error message which has style="display:none"

I am trying to find out why but everybody has only discussed this error message as one which is thrown in the webpage. The changes suggested to web.config are already present in our config file.

回答1:

The following was my solution:

<system.web>
  <httpHandlers>
    <add verb=" * "  path="Reserved.ReportViewerWebControl.axd" 
         type="Microsoft.Reporting.WebForms.HttpHandler,
               Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral,
               PublicKeyToken=b03f5f7f11d50a3a" />
  </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>
</system.webServer>


回答2:

I just checked in an app that includes a ReportViewer control and which has been in production without any issues for almost a year, and the same content is found in the HTML content.

So given the fact that this div is not displayed (CSS attribute display:none), one can guess that it's an error message which is present just for ease of display should the error actually occur. If the error involves something client-side, then it's much easier to implement it that way: all the client-side script has to do to display the message is change the style attribute--there's no need to manipulate the DOM to append the error message, and no need to get the localized error message in the adequate language in javascript (given the localization support of ReportViewer through language packs, there's a different version of this error message per language--much easier to handle this on the ASP.NET side alongside all the other localized content than in the browser in javascript). Yes, I am doing psychology here! :)



回答3:

To be safe add configuration of IIS6 and IIS7.

IIS6:

<system.web>
    <httpHandlers>
        <add verb=" * "
             path="Reserved.ReportViewerWebControl.axd"
             type="Microsoft.Reporting.WebForms.HttpHandler,
                   Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral,
                   PublicKeyToken=b03f5f7f11d50a3a" />
    </httpHandlers>
</system.web>

IIS7:

<system.webServer>
   <handlers>
      <add 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>


回答4:

This is how my declaration of report viewer control looks like in web.config. Make you sure you have something similar in there. And add if you don't have it. The version of the control might not be the same tho.

<configuration>
    ...
    </system.web>
        ...
        <httpHandlers>
            ...
            <add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            ...
        </httpHandlers>
        ...
    </system.web>
    ...
</configuration>


回答5:

For IIS 7 use the following code in your web.config

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


回答6:

I was also facing same problem of report viewer not displaying. After setting display property from browser i got my error as "Report Viewer Configuration error".

I have found that for some parameter i am sending incorrect values i.e. "string .empty". I changed my code to send some value or null to parameter. Now my report is displaying properly. I have resolved my issue by sending correct report parameter values to report. Don't miss any parameter to assign proper values or null.



回答7:

The following code are as follows

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



回答8:

After changing the web.config file depending on IIS version, try add this code part:

  if(!IsPostBack){
        // Here codes about ReportViewer1 
    }

You can check this similar problem.