如何使用c#在asp.net页面中部署或显示SSRS报告?

时间:2013-07-05 06:22:24

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

我已经制作了一份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());
    } 

我从这里取得的CustomReportCredentialsPassing 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>

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

1 个答案:

答案 0 :(得分:0)

您需要将设置放在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

相关问题