C# 报告查看器配置错误 - 在网页的查看源中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11419059/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 17:48:46  来源:igfitidea点击:

Report Viewer Configuration error - In View Source of webpage

c#reportviewer

提问by sarada

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

报告查看器 Web 控制 HTTP 处理程序尚未在应用程序的 web.config 文件中注册。添加

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

到 web.config 文件的 system.web/httpHandlers 部分,或添加

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

到 Internet Information Services 7 或更高版本的 system.webServer/handlers 部分

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"

注意:此错误消息周围有一个 div 标签,其样式为 =“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.

我试图找出原因,但每个人都只将此错误消息作为网页中抛出的错误消息进行了讨论。建议对 web.config 进行的更改已经存在于我们的配置文件中。

回答by Dimitri

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.

这就是我在 web.config 中声明的报表查看器控件的样子。确保那里有类似的东西。如果没有,请添加。控件的版本可能不一样。

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

回答by nunespascal

To be safe add configuration of IIS6 and IIS7.

为了安全起见,添加 IIS6 和 IIS7 的配置。

IIS6:

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:

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>

回答by Clafou

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.

我刚刚签入了一个包含 ReportViewer 控件的应用程序,该应用程序已投入生产近一年没有任何问题,并且在 HTML 内容中发现了相同的内容。

So given the fact that this divis 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! :)

因此,考虑到它div没有显示(CSS 属性display:none)这一事实,人们可以猜测这是一条错误消息,如果错误实际发生,它只是为了便于显示而出现。如果错误涉及客户端,那么以这种方式实现它会容易得多:客户端脚本显示消息所需要做的就是更改样式属性——无需操作 DOM 来附加错误消息,并且无需在 javascript 中以适当的语言获取本地化的错误消息(鉴于 ReportViewer 通过语言包的本地化支持,每种语言都有不同版本的此错误消息——在 ASP.NET 上更容易处理此问题与所有其他本地化内容并排放置,而不是在 javascript 中的浏览器中)。是的,我在这里做心理学!:

回答by Nathan Yeung

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

对于 IIS 7,请在 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>

回答by caygun

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

根据 IIS 版本更改 web.config 文件后,尝试添加以下代码部分:

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

You can check this similar problem.

你可以检查这个类似的问题

回答by Darrell Robert Parker

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>

回答by Surekha Kolekar

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.

我发现对于某些参数,我发送了不正确的值,即“字符串 .empty”。我更改了代码以向参数发送一些值或空值。现在我的报告显示正常。我通过发送正确的报告参数值来解决我的问题。不要错过任何参数来分配正确的值或 null。

回答by sameer

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>