【问题标题】:How to deploy or show a SSRS report in asp.net page using c#?如何使用 c# 在 asp.net 页面中部署或显示 SSRS 报告?
【发布时间】:2013-07-05 06:22:24
【问题描述】:

我制作了一个 SSRS 报告,当我运行报告时显示所有所需的数据,但当我尝试在浏览器上查看时,

http://localhost/Reporting/SSRSTestReport

它给了我一个错误

HTTP 错误 404.0 - 未找到 您正在寻找的资源已被 已删除、更改名称或暂时不可用。

当我试图在aspx 页面中显示它时,它给了我这样的错误:

The attempt to connect to the report server failed. Check your connection information   and that the report server is a compatible version.
The request failed with HTTP status 404: Not Found.

现在我在 aspx.cs 页面中执行此操作:

 try
    {
        IReportServerCredentials irsc = new CustomReportCredentials("sa", "arindam", "ITPL_PC1");
        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
        ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://localhost/Reporting/SSRSTestReport");
        ReportViewer1.ServerReport.ReportServerCredentials = irsc;
        ReportViewer1.ServerReport.ReportPath = "D:\\SSRSTest\\SSRSTest\\SSRSTest\\SSRSTestReport";
        ReportViewer1.ServerReport.Refresh();

    }
    catch (Exception ex)
    {
        Response.Write(ex.ToString());
    } 

CustomReportCredentials 我从这里拿走了:Passing Credentials to Sql Report Server 2008

这是我的 web.config 中的 http handler

<httpHandlers>
        <remove path="*.asmx" verb="*"/>
        <add path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
        <add path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
        <add path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
        <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
    </httpHandlers>

请帮我解决这个问题,我知道我遗漏了一些东西但找不到它

【问题讨论】:

  • 您的 web.config 中似乎缺少 axd 条目。分享有关 http 处理程序的部分,我可以告诉您您缺少什么。
  • 可以告诉我我缺少什么。
  • 将 web.config 中的 http 处理程序粘贴到问题中
  • 是的,我做到了。请立即检查
  • 您的设置仅对 IIS6 有效。什么版本的 IIS?

标签: c# asp.net reporting-services ssrs-2008


【解决方案1】:

您需要将您的设置放在system.webServer 部分

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

参考:How to: Register HTTP Handlers

【讨论】:

  • http 处理程序在system.web 部分,我猜它和之前一样
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-01-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-11-19
相关资源
最近更新 更多