New to Telerik Reporting? Download free 30-day trial

Web Report Designer Cannot Preview Reports

Environment

Product Progress® Telerik® Reporting
Project Type Web Application
Report Viewer HTML5

Description

When the Preview button of the Web Report Designer is clicked, instead of displaying a rendered report in the report viewer, there is a message saying that the service is not accessible.

Error Message

The error message, displayed on the page, is the following:

Cannot access the Reporting REST service. (serviceUrl = '/api/reportdesigner'). Make sure the service address is correct and enable CORS if needed. (https://enable-cors.org)

The error message, displayed in the browser console, is the following:

System.UriFormatException: Invalid URI: The format of the URI could not be determined.
        at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
        at System.Uri..ctor(String uriString, UriKind uriKind)
        at Telerik.Reporting.Processing.PathResolver..ctor(String baseDir)
        at Telerik.WebReportDesigner.Services.ResourceResolver..ctor(IResourceStorage resourceStorage, String definitionDir)
        at Telerik.WebReportDesigner.Services.Controllers.ReportDesignerControllerBase.CreateResourceResolver()
        at Telerik.WebReportDesigner.Services.Controllers.ReportDesignerControllerBase.get_ProcessingContext()
        at Telerik.Reporting.Services.AspNetCore.ReportsControllerBase.get_Engine()
        at Telerik.Reporting.Services.AspNetCore.ReportsControllerBase.GetVersion()
        at lambda_method262(Closure , Object , Object[] )
        at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
        at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
        at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
        at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
        at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
        at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
    --- End of stack trace from previous location ---
        at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

Possible Cause

The known reason for this error is using a relative path for the FileDefinitionStorage constructor of the Web Report Designer.

Solution

Pass an absolute path to the FileDefinitionStorage constructor

Workarounds

If it is not possible or wanted to pass absolute path to the constructor, create a custom ResourceResolver that implements the IResourceResolver interface.

The custom ResourceResolver class should then be registered in the application's configuration file, for example, appsettings.json:

"telerikReporting": {
    "processing": {
        "resourceResolver": {
            // The element below represents a custom implementation of resource resolver:
            "provider": "custom",
            "parameters": [
                {
                    "name": "typeName",
                    "value": "CSharp.Net6.BlazorIntegrationDemo.CustomResourceResolver, CSharp.Net6.BlazorIntegrationDemo"
                }
            ]
        }
    }
}
In this article