js/telerikreportviewer 404 not found

2 Answers 62 Views
Report Viewer - MVC
Ihits
Top achievements
Rank 1
Iron
Ihits asked on 04 Dec 2023, 12:43 PM

Hi,

I was trying to integrate a report in my MVC application.

In the console I m getting an error

"GET
http://localhost:55497/api/reports/resources/js/telerikReportViewer
[HTTP/1.1 404 Not Found 4ms]"

 

How can i fix this issue.

index.cshtml

-------------------------

 

@using Telerik.Reporting
@using Telerik.ReportViewer.Mvc
@{
    ViewBag.Title = "Home Page";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="https://kendo.cdn.telerik.com/2020.1.114/styles/kendo.common.min.css" rel="stylesheet" />
<link href="https://kendo.cdn.telerik.com/2020.1.114/styles/kendo.blueopal.min.css" rel="stylesheet" />

@section styles
{
    <style>
        body {
            margin: 5px;
            font-family: Verdana, Arial, sans-serif;
        }

        #reportViewer1 {
            position: absolute;
            left: 5px;
            right: 5px;
            top: 40px;
            bottom: 5px;
            overflow: hidden;
            clear: both;
        }
    </style>
}



<div>
    @(Html.TelerikReporting().ReportViewer()
                    .Id("reportViewer1")
                    .ServiceUrl(Url.Content("~/api/reports/"))
                    .ReportSource("Report1.trdp")
                    .ViewMode(ViewMode.Interactive)
                    .ScaleMode(ScaleMode.Specific)
                    .Scale(1.0)
                    .PersistSession(false)
                    .PrintMode(PrintMode.AutoSelect)
                    .EnableAccessibility(false)
                    .SearchMetadataOnDemand(false)
                    .Deferred()
)
</div>
@section scripts
{
    <script src="@Url.Content("~/api/reports/resources/js/telerikReportViewer")"></script>
    @(Html.TelerikReporting().DeferredScripts())
}

 

I was referring to the code  from here

 



2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 05 Dec 2023, 02:31 PM

Hello,

Thanks for linking the guide used for reference!

I checked out the Embed Reports into ASP.NET MVC Applications Tutorial (telerik.com) post and it seems to cover only the front-end part of the report viewer integration. However, the web report viewers render the reports through a reporting service, and the JS resource of the viewer is also usually retrieved from there(good practice to ensure that the versions of the viewer and service match).

In this case, I assume that the reporting service is not implemented in your project, thus the error about the URL returning 404.

I suggest going through the Integrating ASP.NET MVC Report Viewer With Reporting REST Service - Telerik Reporting article which will guide you on how to fully integrate the viewer and service of the latest versions of Telerik Reporting. This guide covers how to do it with our Visual Studio item templates wizards which are added upon product installation but if you wish to do it manually without using the Telerik Reporting VS extension, then you may follow the Manually Setting Up the HTML5 MVC Report Viewer - Telerik Reporting article.

If you run into any issues, you may also check out our demo project solutions which demonstrate how to integrate each viewer. The projects can be found in the installation folder, for example, C:\Program Files (x86)\Progress\Telerik Reporting R3 2023\Examples\CSharp.

I hope that this will help. Please let me know if you need further assistance.

Regards,
Dimitar
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
0
Ihits
Top achievements
Rank 1
Iron
answered on 06 Dec 2023, 09:07 AM

Hi,

Found my problem. I did not add WebApiconfig.cs file and also teh changes Global.asax file.

Thanks for the response

Tags
Report Viewer - MVC
Asked by
Ihits
Top achievements
Rank 1
Iron
Answers by
Dimitar
Telerik team
Ihits
Top achievements
Rank 1
Iron
Share this question
or