0

I'm trying to access the SSRS 2017 through an ASP.NET project but getting the below error. I'm facing the issue on ASPX page at line which is in bold below.

Server Error in '/' Application.


The request failed with HTTP status 404: Not Found. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The request failed with HTTP status 404: Not Found.

Source Error:

ReportViewer1.ServerReport.ReportPath = ViewData["ReportPath"].ToString(); ReportViewer1.ServerReport.SetParameters((List)ViewData["Parameters"]);

This is how my aspx looks like.

    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"  
     Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceHolder" runat="server">
        <script runat="server" language="C#">
        protected void Page_Load(object sender, EventArgs e)
    {
             //Setup the ReportViewer control
            ReportViewer1.ProcessingMode = ProcessingMode.Remote;
            ReportViewer1.AsyncRendering = true;
            ReportViewer1.SizeToReportContent = true;
            ReportViewer1.ShowBackButton = false;
            ReportViewer1.ShowCredentialPrompts = false;
            ReportViewer1.ShowDocumentMapButton = false;
            ReportViewer1.ShowFindControls = false;
            ReportViewer1.ShowPageNavigationControls = false;
            ReportViewer1.ShowParameterPrompts = false;
            ReportViewer1.ShowPromptAreaButton = false; 
            ReportViewer1.ShowRefreshButton = false;
            ReportViewer1.ShowZoomControl = false;  

            ReportViewer1.ServerReport.ReportServerUrl = (Uri)ViewData["ReportUrl"];
            ReportViewer1.ServerReport.ReportPath = ViewData["ReportPath"].ToString();
            //ReportViewer1.ServerReport.ReportServerCredentials = (ReportViewerCredentials)ViewData["ReportUser"];      

 ReportViewer1.ServerReport.SetParameters((List<Microsoft.Reporting.WebForms.ReportParameter>)ViewData["Parameters"]);

    }
</script>

<form runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <rsweb:ReportViewer ID="ReportViewer1" runat="server"></rsweb:ReportViewer>
    <br />

        <%=Html.ActionLink("Back", "Index") %>
</form>

    </asp:Content>

Do i need to make any changes aspx so that it can be render properly, i'm getting an error at Line

    ReportViewer1.ServerReport.SetParameters((List<Microsoft.Reporting.WebForms.ReportParameter>)ViewData["Parameters"]);
  • Error indicates server is not found. This could be due to URL being wrong or a security issue. Server may require https (secure) and the SSL/TLS is bad. It may also indicate that the Report is not on the server. – jdweng Jun 18 '20 at 22:01
  • Thanks @jdweng for your response, Reporting URL is working fine when i'm accessing it from browser directly but only i'm facing this problem when i'm trying to access through my ASP.NET web project. I used to update the working reporting URL in my configuration but it seems there is some issue with "ReportViewer" in my project. I'm unable to identify cause of this. – user13771247 Jun 18 '20 at 22:32
  • Use a sniffer like wireshark or fiddler and compare browser results with c# results. Compare first request from browser with first request in c#. The default headers are different in c# from browser. Make c# headers look exactly like the browser headers. – jdweng Jun 19 '20 at 00:47
  • Thanks @jdweng, i have updated by asks, If are able to fix it, can please check – user13771247 Jun 19 '20 at 16:02
  • Check path and url. See : https://learn.microsoft.com/en-us/sql/reporting-services/application-integration/using-the-webforms-reportviewer-control?view=sql-server-ver15 – jdweng Jun 19 '20 at 16:09
  • Hi @jdweng- Parameters are not rendering in "setparameters" properties which is in "ServerReport" object. Parameters are being populated in (List)ViewData["Parameters"] but not being rendered in Setparameters, due to this my asp.net solution is unable to connect with SSRS report server which is hosted on different IP and getting failed with empty response error. Could you please suggest what should i do? – user13771247 Jun 30 '20 at 15:38
  • So you fixed the error 404? The Report is a RDLC file with Command-Text tags with the SQL query. So I normally open RDLC with notepad and find the Command Text and paste into Sql Server Management Studio. The Command Text is HTML so you have to replace some of the special characters like & (the ampersand which is an AND with just &) and any angle brackets > and &lt. I think the error is a query for SSQL Table ViewData and column "Parameter". SSMS should give better error messages than the report manager. – jdweng Jun 30 '20 at 15:47
  • @jdweng- No, error is still same? "The request failed with HTTP status 404: Not Found", as it's very generic error message so while further digging into it, Parameters is not beings rendered in Setparameter property and that's why it is failing. BTW, i'm trying to integrate my asp.net MVC solution with updated version of reporting services 2017. Earlier report was working fine when it was RDL file and old version. But in Reporting server 2017, the file type is not RDL and i need to integrate my solution to latest SSRS 2017 so that i can view the report. I'm not sure what i'm missing. – user13771247 Jul 01 '20 at 14:46
  • A RDLC file was always a html file with just a different extension. You had to add the RDLC to the Server with a URL and you accessed it through the URL. Not sure what is different in 2017 (see : https://www.sqlshack.com/whats-new-reporting-services-ssrs-2017/). but we always had issues when a new SQL Server was installed that people would not setup the URLs properly and add the RDLC reports. The 404 error is just indicating the URL is not found. So I think you still have issues with configuring the Report View and not the content of the report. – jdweng Jul 01 '20 at 15:41

0 Answers0