I am using Telerik report in my c# project using their REST service, I am using the R1 2017 version, the parameters are all loading and their respective data from the database is also loading but I am getting this error when I click on preview,
When I analyzed the Telerik DLL with the error it meant that the parameters values list is null, but it can't be because I checked the network log, all the parameters are being passed to the REST API. This is the payload I'm sending
{"report":"Activity/Registered Users Report.trdp/VisionReport","parameterValues":{"CPR":"353464654","EMAIL":"","MOBILE":"","FromDate":"2023-12-31T00:00:00.000Z","ToDate":"2024-01-01T00:00:00.000Z","ChannelId":["006","002","005"]}}
to this telerik URL :
https://localhost:44302/api/reports/clients/aaf42228070/instances
When I run the same code and report in my local environment it runs properly. Still, when I deploy the code to the server, I receive this error, I ran the report on Telerik Designer on the server, there also it loads fine, it only causes issues when I am loading it in the browser on the server. Following is the complete error I'm receiving from Telerik.
{message: "An error has occurred.", exceptionMessage: "Value cannot be null. ↵Parameter name: source",…}
exceptionMessage
:
"Value cannot be null.\r\nParameter name: source"
exceptionType
:
"System.ArgumentNullException"
message
:
"An error has occurred."
stackTrace
:
" at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable`1 source, Func`2 selector)\r\n
at Telerik.Reporting.Services.Engine.PersistableCollection`1.GetEnumerator()\r\n
at Telerik.Reporting.Services.Engine.KeyItemPersistableCollection`2.ResolveItem(K referredInstanceKey, Boolean& newItem)\r\n
at Telerik.Reporting.Services.Engine.ReportEngine.CreateReportInstance(String clientID, String report, Dictionary`2 parameterValues)\r\n
at Telerik.Reporting.Services.WebApi.ReportsControllerBase.CreateInstance(String clientID, ClientReportSource reportSource)\r\n
at lambda_method(Closure , Object , Object[] )\r\n
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_1.<GetExecutor>b__3(Object instance, Object[] methodParameters)\r\n
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()
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
I'm trying to implement the REST Custom Report Source Resolver in a .net core web api. But the reports are not showing even the URL is not working. I have used a middleware to connect this to the application. Bellow you can see the regarding. cods.
middleware class
public class TelerikReportingMiddleware
{
private readonly RequestDelegate _next;
public TelerikReportingMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task Invoke(HttpContext context, IAPIService aPIService)
{
string[] path = !string.IsNullOrEmpty(context.Request.Path.Value) ? context.Request.Path.Value.Split("/") : new string[4];
if (path.Length > 2 && path[2] != null && path[2].Equals("telerikreports", StringComparison.CurrentCultureIgnoreCase))
{
if (context.Request.RouteValues["controller"] == null)
{
context.Request.RouteValues["controller"] = path[2];
}
if (context.Request.RouteValues["action"] == null)
{
context.Request.RouteValues["action"] = path[3];
}
if (!context.Request.Headers.ContainsKey("IntegrationID"))
{
var appId = "1";
context.Request.Headers.Add("IntegrationID", appId);
}
}
await _next(context);
}
private async Task ReturnErrorResponse(HttpContext context)
{
context.Response.ContentType = "application/json";
context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
await context.Response.WriteAsJsonAsync("Bad Request: Integration Not Defined, " +
"Request ID Sould be defined in the Header section of the request");
}
}
Report Resolver class
public class BLReportResolver : IReportResolver
{
private readonly string _serverPath;
public BLReportResolver()
{
_serverPath = Path.Combine(Directory.GetCurrentDirectory(), "TelerikReports");
}
public ReportSource Resolve(string reportId)
{
try
{
/* get path to report */
var sourceReportSource = new UriReportSource { Uri = Path.Combine(_serverPath, reportId) };
//retrieve an instance of the report
var reportPackager = new ReportPackager();
using (var sourceStream = File.OpenRead(sourceReportSource.Uri))
{
var report = (Report)reportPackager.UnpackageDocument(sourceStream);
var reportInstance = new InstanceReportSource
{
ReportDocument = report
};
return new InstanceReportSource { ReportDocument = reportInstance.ReportDocument };
}
}
catch (Exception e)
{
Console.WriteLine(e);
return null;
}
}
}
controller class
[Route("api/[controller]")]
[ApiController]
public class TelerikReportsController : ReportsControllerBase
{
static readonly ReportServiceConfiguration configurationInstance =
new ReportServiceConfiguration
{
HostAppId = "TelerikRESTReports",
Storage = new FileStorage(),
ReportResolver = new BLReportResolver(),
ReportSourceResolver = new UriReportSourceResolver(Path.GetFullPath("~/TelerikReports"))
};
public TelerikReportsController()
{
this.ReportServiceConfiguration = configurationInstance;
}
}
what can be the issue?
While rendering report got Error like this Error loading the report viewer's templates. (trvTemplateUrl = 'https://abcdf.com/api/reports/resources/templates/telerikReportViewerTemplate-16.0.22.225.html/'). when i try this same telerik reporting from other domain it's working only this domain it gave this error. and network it shows like CORS error. we don't know where to allow all the domain address. In Asp.net we have this config to enable CORS
services.AddCors(c =>
{
c.AddPolicy("AllowOrigin", options => options.AllowAnyOrigin().AllowAnyHeader().WithExposedHeaders("X-total-count"));
c.AddPolicy("ReportingRestPolicy", corsOptions => corsOptions.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
});
app.UseCors("ReportingRestPolicy");
Hi Support,
Is it possible to download telerik report in xml format? As part of the requirement i need to download the output in xml format and not able to find any helpful link to implement this functionality. I want to download in xml without any 3rd party integration. Is telerik report support this fucntionality?
Hoping for quick reply.
Thanks.
I am trying to upgrade an ASP.Net MVC (.net framework 4.6.1) application from Telerik Reporting R1 2020 to R1 2022 and can't even get the viewer to display. The error on screen says
Cannot access the Reporting REST service. (serviceUrl = '/api/reportsapi/'). Make sure the service address is correct and enable CORS if needed. (https://enable-cors.org)
When I open the browser developer tools I see the error has occurred on the call to api/reportsapi/version and the exception message is:
Multiple actions were found that match the request: \r\nFormats on type FWT.MVC.ReportsAPIController
Any idea where to even begin looking? The prior version worked flawlessly. We do have a custom report resolver because we change the connection string based on the tenant ID of the logged in user, but I have upgraded that.
am trying to upgrade an ASP.Net MVC (.net framework 4.6.1) application from Telerik Reporting R1 2018 to R2 2022 and can't even get the viewer to display. The error on screen says
Cannot access the Reporting REST service. (serviceUrl = '/api/reportsapi/'). Make sure the service address is correct and enable CORS if needed. (https://enable-cors.org)
When I open the browser developer tools I see the error has occurred on the call to api/reportsapi/version and the exception message is:
Multiple actions were found that match the request: System.Net.Http.HttpResponseMessage GetDocumentFormats() no tipo Telerik.Reporting.Services.WebApi.ReportsControllerBase System.Net.Http.HttpResponseMessage GetClientsSessionTimeoutSeconds() no tipo Telerik.Reporting.Services.WebApi.ReportsControllerBase System.Net.Http.HttpResponseMessage GetVersion() no tipo Telerik.Reporting.Services.WebApi.ReportsControllerBase</ExceptionMessage>
Any idea where to even begin looking? The prior version worked flawlessly. We do have a custom report resolver because we change the connection string based on the tenant ID of the logged in user, but I have upgraded that.
After upgrading the Telerik Report to version 1021, the report viewer is unable load properly.
In the console, I'm getting an error: Failed to load resource: the server responded with a status of 404 (Not Found) ... http://localhost:8080/api/reportservice/resources/js/telerikReportViewer-14.2.20.1021.min.js
Is this because of the Telerik Reporting REST API not properly hosted?
How should I fix this issue?
Thanks!