I am trying to run a report in a web application .net core 2
I have followed the HTML5 Report Viewer in ASP.NET Core 2 Article with no success
I have added the below controller.
namespace schoolAppCore.Controllers
{
[Route("api/reports")]
public class ReportsController : Controller
{
string reportsPath = string.Empty;
public ReportServiceConfiguration ReportServiceConfiguration { get; }
public ReportsController(IHostingEnvironment environment)
{
this.reportsPath = Path.Combine(environment.WebRootPath, "Report1.trdp");
this.ReportServiceConfiguration = new ReportServiceConfiguration
{
HostAppId = "schoolAppCore",
Storage = new FileStorage(),
ReportResolver = new ReportTypeResolver()
.AddFallbackResolver(new ReportFileResolver(this.reportsPath)),
};
}
[HttpGet("reportlist")]
public IEnumerable<
string
> GetReports()
{
return Directory
.GetFiles(this.reportsPath)
.Select(path =>
Path.GetFileName(path));
}
}
}
and also I have added a controller named to run the View as following:
public class TelerikController : Controller
{
public IActionResult viewreport()
{
return View("reportViewer");
}
}
finally the Report view itself as following:
<
html
>
<
head
>
<
meta
name
=
"viewport"
content
=
"width=device-width, initial-scale=1, maximum-scale=1"
/>
<
title
></
title
>
<
script
src
=
"~/lib/jquery/dist/jquery.min.js"
></
script
>
<
link
href
=
"~/styles/kendo.common.min.css"
rel
=
"stylesheet"
/>
<
link
href
=
"~/styles/kendo.blueopal.min.css"
rel
=
"stylesheet"
/>
<
script
src
=
"~/lib/Kendo/telerikReportViewer.kendo-12.1.18.620.min.js"
></
script
>
<
script
src
=
"~/lib/Kendo/telerikReportViewer-12.1.18.620.min.js"
></
script
>
<
style
>
#reportViewer1 {
position: absolute;
left: 5px;
right: 5px;
top: 50px;
bottom: 5px;
overflow: hidden;
font-family: Verdana, Arial;
}
</
style
>
</
head
>
<
body
>
<
div
id
=
"reportViewer1"
>
loading...
</
div
>
<
script
>
$(document).ready(function () {
$("#reportViewer1")
.telerik_ReportViewer({
serviceUrl: "api/reports/",
//"resources/templates/telerikReportViewerTemplate.html"
reportSource: {
// report: "Telerik.Reporting.Examples.CSharp.ReportCatalog, CSharp.ReportLibrary",
report: "Report1.trdp",
parameters: {}
},
viewMode: telerikReportViewer.ViewModes.INTERACTIVE,
scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,
scale: 1.0,
});
});
</
script
>
</
body
>
</
html
>
I am getting the below error
jquery.min.js:4 GET https://localhost:44332/telerik/api/reports/resources/templates/telerikReportViewerTemplate-html 404 ()
and also (viewreport:1 Uncaught (in promise) undefined)
can some one help in getting this run in core 2 Application