From 9f9a66a1ba8c5fd0c6542fb6a9960f62cc3548d4 Mon Sep 17 00:00:00 2001 From: Todor Arabadzhiev Date: Thu, 30 Apr 2026 15:16:55 +0300 Subject: [PATCH 1/8] Update host-reports-service-in-.net-5.md --- .../host-reports-service-in-.net-5.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-5.md b/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-5.md index 5310e24d0..b69601e9d 100644 --- a/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-5.md +++ b/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-5.md @@ -11,7 +11,7 @@ position: 3 previous_url: /telerik-reporting-rest-service-aspnetcore-net5,/embedding-reports/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-core-web-api-implementation/host-reports-service-in-.net-5 --- -# Hosting the Telerik Reporting REST Service in an ASP.NET Core Application in {{site.dotnetversions}} with Startup.cs +# Hosting the Reporting REST Service in ASP.NET Core with Main Method This article guides you on how to host a Reports Web Service in order to expose the Reports Generation Engine to an ASP.NET Core in .NET Web Application. The configuration of the application in this tutorial is set up in the `Startup.cs` file of the project. @@ -74,7 +74,7 @@ This guide applies the recommended NuGet package references approach to add the The [`ConfigureServices`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.webhostbuilder.configureservices) method inside the `Startup.cs` file in the project should be modified in order to enable the Reports Service functionality. -1. Set up the [ReportServiceConfiguration](/api/telerik.reporting.services.reportserviceconfiguration) by invoking the `AddTelerikReporting` extension method on the [IMvcBuilder](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.imvcbuilder) object. In the code below, the first argument will represent the [HostAppId](/api/telerik.reporting.services.reportserviceconfiguration#Telerik_Reporting_Services_ReportServiceConfiguration_HostAppId) of the [ReportServiceConfiguration](/api/telerik.reporting.services.reportserviceconfiguration) object, while the second is the path that will be passed to the [UriReportSourceResolver](/api/telerik.reporting.services.urireportsourceresolver): +1. Set up the [ReportServiceConfiguration](/api/telerik.reporting.services.reportserviceconfiguration) by invoking the `AddTelerikReporting` extension method on the [IMvcBuilder](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.imvcbuilder) object. In the code below, the first argument will represent the [HostAppId](/api/telerik.reporting.services.reportserviceconfiguration#telerik_reporting_services_reportserviceconfiguration_hostappid) of the [ReportServiceConfiguration](/api/telerik.reporting.services.reportserviceconfiguration) object, while the second is the path that will be passed to the [UriReportSourceResolver](/api/telerik.reporting.services.urireportsourceresolver): {{source=CodeSnippets\Blazor\Docs\ProgramWithRestConfig.cs region=Call_AddTelerikReporting}} From 912fb5be3d1ff2f12e62e24c556913e752b9848d Mon Sep 17 00:00:00 2001 From: Todor Arabadzhiev Date: Thu, 30 Apr 2026 15:23:55 +0300 Subject: [PATCH 2/8] Update host-reports-service-in-.net-with-controllers.md --- .../host-reports-service-in-.net-with-controllers.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-with-controllers.md b/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-with-controllers.md index 52f4d365f..6c49f767b 100644 --- a/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-with-controllers.md +++ b/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-with-controllers.md @@ -25,13 +25,13 @@ The guide is separated into sections for readability reasons. Along with the ste ## Using the REST Service Project Template -In Visual Studio open the **Add New Project** dialog and select _Telerik Reporting REST Service_ project template. After clicking `Create` a menu pops up that allows you to configure the following properties of the REST Service: target framework, service clients (report viewer and report designer), Cross-Origin Resource Sharing, Host Application ID, and Application URL. +In Visual Studio open the **Add New Project** dialog and select _Telerik Reporting REST Service_ project template. After clicking **Create** a menu pops up that allows you to configure the following properties of the REST Service: target framework, service clients (report viewer and report designer), Cross-Origin Resource Sharing, Host Application ID, and Application URL. ![REST Service Project Configuration page from the Visual Studio project template for adding Telerik Reporting REST Service](images/rest-service-project-configuration-menu-net6.png) Set the Target Framework to .NET {{site.mindotnetversion}} or higher. -Once you have configured the rest of the options to your liking, click `Finish` and a new project, containing all the necessary files and packages to host the Telerik Reporting REST service instance, will be added to your solution. +Once you have configured the rest of the options to your liking, click **Finish** and a new project, containing all the necessary files and packages to host the Telerik Reporting REST service instance, will be added to your solution. ## Manually configuring the Telerik.Reporting REST Service @@ -53,7 +53,7 @@ In this tutorial, the resulting service will use the sample report definitions d 1. Add a new folder to your solution called `Reports` and copy all sample reports into it. 1. Later in the tutorial we will make sure that the ReportsController is able to resolve the definitions for the requested reports from this project folder. -> It is recommended to use declarative definitions (TRDP/TRDX/TRBP) authored using the [Standalone Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/desktop-designers/standalone-report-designer/overview) or the [Web Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/web-report-designer/overview) in order to take advantage of their design-time tooling because the VS integrated report designer tooling is still not available in .NET {{site.mindotnetversion}}+ projects. +> tip It is recommended to use declarative definitions (TRDP/TRDX/TRBP) authored using the [Standalone Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/desktop-designers/standalone-report-designer/overview) or the [Web Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/web-report-designer/overview) in order to take advantage of their design-time tooling because the VS integrated report designer tooling is still not available in .NET {{site.mindotnetversion}}+ projects. ### Add the Required Dependencies @@ -118,7 +118,7 @@ The last supported type of **ConnectionStrings** configuration uses an array to 1. Create folder `Controllers`. Right-click on the project name and select **Add** > **New folder**. Name it `Controllers`. 1. Implement a Reports controller. Right-click on the `Controllers` folder and add a new item: **Add** > **New item** > **API Controller - Empty** item. Name it `ReportsController`. This will be our Telerik Reporting REST service in the project. -1. Inherit the [ReportsControllerBase](/api/Telerik.Reporting.Services.WebApi.ReportsControllerBase) type and inject the configuration settings in the constructor. This is how a basic implementation of the controller should look like: +1. Inherit the [ReportsControllerBase](/api/telerik.reporting.services.webapi.reportscontrollerbase) type and inject the configuration settings in the constructor. This is how a basic implementation of the controller should look like: {{source=CodeSnippets\Blazor\Docs\Controllers\ReportsController.cs}} From f1fc27bc27f77803ce4e0a9c30895e024c1a3f77 Mon Sep 17 00:00:00 2001 From: Todor Arabadzhiev Date: Thu, 30 Apr 2026 15:31:49 +0300 Subject: [PATCH 3/8] Update host-reports-service-in-.net-6-with-minimal-api.md --- .../host-reports-service-in-.net-6-with-minimal-api.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-6-with-minimal-api.md b/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-6-with-minimal-api.md index e36635e1e..4616369ca 100644 --- a/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-6-with-minimal-api.md +++ b/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-6-with-minimal-api.md @@ -25,13 +25,13 @@ The guide is separated into sections for readability reasons. Along with the ste ## Using the REST Service Project Template -In Visual Studio, open the **Add New Project** dialog and select the _Telerik Reporting REST Service_ project template. After clicking `Create`, a menu pops up that allows you to configure the following properties of the REST Service: target framework, service clients (report viewer and report designer), Cross-Origin Resource Sharing, Host Application ID, and Application URL. +In Visual Studio, open the **Add New Project** dialog and select the _Telerik Reporting REST Service_ project template. After clicking **Create**, a menu pops up that allows you to configure the following properties of the REST Service: target framework, service clients (report viewer and report designer), Cross-Origin Resource Sharing, Host Application ID, and Application URL. ![REST Service Project Configuration page from the Visual Studio project template for adding Telerik Reporting REST Service](images/rest-service-project-configuration-menu-net6.png) Set the Target Framework to .NET {{site.mindotnetversion}} or higher. -Once you have configured the rest of the options to your liking, click `Finish` and a new project, containing all the necessary files and packages to host the Telerik Reporting REST service instance, will be added to your solution. +Once you have configured the rest of the options to your liking, click **Finish** and a new project, containing all the necessary files and packages to host the Telerik Reporting REST service instance, will be added to your solution. ## Manually configuring the Telerik.Reporting REST Service @@ -53,7 +53,7 @@ In this tutorial, the resulting service will use the sample report definitions d 1. Add a new folder to your solution called `Reports` and copy all sample reports into it. 1. Later in the tutorial, we will make sure that the ReportsController can resolve the definitions for the requested reports from this project folder. -> It is recommended to use declarative definitions (TRDP/TRDX/TRBP) authored using the [Standalone Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/desktop-designers/standalone-report-designer/overview) or the [Web Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/web-report-designer/overview) to take advantage of their design-time tooling because the VS integrated report designer tooling is still not available in .NET {{site.mindotnetversion}}+ projects. +> tip It is recommended to use declarative definitions (TRDP/TRDX/TRBP) authored using the [Standalone Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/desktop-designers/standalone-report-designer/overview) or the [Web Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/web-report-designer/overview) to take advantage of their design-time tooling because the VS integrated report designer tooling is still not available in .NET {{site.mindotnetversion}}+ projects. ### Add the Required Dependencies @@ -70,11 +70,11 @@ This guide applies the recommended NuGet package references approach to add the ### Setup the Program.cs file as a starting point of the Reporting REST Service project with Minimal APIs -> When the [Minimal API](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis) approach for hosting the Reporting REST Service is used, exceptions thrown by the service are propagated to and displayed in the Report Viewer. If this is undesired, set up the service using the 'Controllers' approach - [Hosting the Reporting REST Service in ASP.NET Core with Controllers](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-core-web-api-implementation/host-reports-service-in-.net-with-controllers) +> important When the [Minimal API](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis) approach for hosting the Reporting REST Service is used, exceptions thrown by the service are propagated to and displayed in the Report Viewer. If this is undesired, set up the service using the 'Controllers' approach - [Hosting the Reporting REST Service in ASP.NET Core with Controllers](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-core-web-api-implementation/host-reports-service-in-.net-with-controllers) Modify the `Program.cs` file in the project to enable the Reports Service functionality. -1. Set up the [ReportServiceConfiguration](/api/telerik.reporting.services.reportserviceconfiguration) by invoking the `AddTelerikReporting` extension method on the [IMvcBuilder](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.imvcbuilder) object. In the code below, the first argument will represent the [HostAppId](/api/telerik.reporting.services.reportserviceconfiguration#Telerik_Reporting_Services_ReportServiceConfiguration_HostAppId) of the [ReportServiceConfiguration](/api/telerik.reporting.services.reportserviceconfiguration) object, while the second is the path that will be passed to the [UriReportSourceResolver](/api/telerik.reporting.services.urireportsourceresolver): +1. Set up the [ReportServiceConfiguration](/api/telerik.reporting.services.reportserviceconfiguration) by invoking the `AddTelerikReporting` extension method on the [IMvcBuilder](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.imvcbuilder) object. In the code below, the first argument will represent the [HostAppId](/api/telerik.reporting.services.reportserviceconfiguration#telerik_reporting_services_reportserviceconfiguration_hostappid) of the [ReportServiceConfiguration](/api/telerik.reporting.services.reportserviceconfiguration) object, while the second is the path that will be passed to the [UriReportSourceResolver](/api/telerik.reporting.services.urireportsourceresolver): {{source=CodeSnippets\Blazor\Docs\ProgramWithRestConfig.cs region=Call_AddTelerikReporting}} From 258827c8e7deb49847f3c87262b4e618cbcc79a3 Mon Sep 17 00:00:00 2001 From: Todor Arabadzhiev Date: Thu, 30 Apr 2026 17:34:09 +0300 Subject: [PATCH 4/8] aps.net updates --- .../add-rest-web-api-to-web-application.md | 14 +++++----- ...the-reportscontroller-in-an-application.md | 20 +++++++------- ...elf-host-telerik-reporting-rest-web-api.md | 26 ++++++++++--------- .../overview.md | 8 +++--- .../requirements.md | 10 ++++--- 5 files changed, 42 insertions(+), 36 deletions(-) diff --git a/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/add-rest-web-api-to-web-application.md b/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/add-rest-web-api-to-web-application.md index 23afe35b6..dfd20cc9a 100644 --- a/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/add-rest-web-api-to-web-application.md +++ b/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/add-rest-web-api-to-web-application.md @@ -39,14 +39,14 @@ The project has a preconfigured implementation of the reports controller that us 1. Make sure that the project has the following assembly references: - - Newtonsoft.Json.dll - - System.Web.Http.dll - - System.Web.Http.WebHost.dll - - System.Net.Http.dll - - System.Net.Http.Formatting.dll + - `Newtonsoft.Json.dll` + - `System.Web.Http.dll` + - `System.Web.Http.WebHost.dll` + - `System.Net.Http.dll` + - `System.Net.Http.Formatting.dll` 1. [Implement the `ReportsController` in your application](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-web-api-implementation/how-to-implement-the-reportscontroller-in-an-application) -1. (Only for Empty Web Application) Add a new item "Global Application Class". +1. (Only for Empty Web Application) Add a new item **Global Application Class**. 1. Invoke [RegisterRoutes](/api/telerik.reporting.services.webapi.reportscontrollerconfiguration#telerik_reporting_services_webapi_reportscontrollerconfiguration_registerroutes_system_web_http_httpconfiguration_) at the beginning of the `Global.Application_Start (Global.asax)` method: {{source=CodeSnippets\MvcCS\Global.asax.cs region=ReportsControllerConfiguration_RegisterRoutes}} @@ -66,7 +66,7 @@ The project has a preconfigured implementation of the reports controller that us 1. Enable [Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) (_optional_) 1. Add the `Microsoft.AspNet.WebApi.Cors` NuGet package to the project. It may add other required references. It may be necessary to upgrade some of the already installed packages. - 1. Add the following code at the beginning of the `Global.Application_Start` (**Global.asax**) method: + 1. Add the following code at the beginning of the `Global.Application_Start` (`Global.asax`) method: {{source=CodeSnippets\MvcCS\Global.asax.cs region=EnableCors}} {{source=CodeSnippets\MvcVB\Global.asax.vb region=EnableCors}} diff --git a/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/how-to-implement-the-reportscontroller-in-an-application.md b/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/how-to-implement-the-reportscontroller-in-an-application.md index 26741923e..a26d5e1e9 100644 --- a/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/how-to-implement-the-reportscontroller-in-an-application.md +++ b/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/how-to-implement-the-reportscontroller-in-an-application.md @@ -12,9 +12,9 @@ previous_url: /telerik-reporting-rest-implementing-http-service,/embedding-repor # Implementing the ReportsController in an ASP.NET Application -The Telerik Reporting REST Web API service is represented by the abstract [ReportsControllerBase](/api/Telerik.Reporting.Services.WebApi.ReportsControllerBase) class. +The Telerik Reporting REST Web API service is represented by the abstract [ReportsControllerBase](/api/telerik.reporting.services.webapi.reportscontrollerbase) class. -This abstract class requires [IReportSourceResolver](/api/Telerik.Reporting.Services.IReportSourceResolver) and [IStorage](/api/Telerik.Reporting.Cache.Interfaces.IStorage) implementations. To add the reports controller to your application, follow the steps: +This abstract class requires [IReportSourceResolver](/api/telerik.reporting.services.ireportsourceresolver) and [IStorage](/api/telerik.reporting.cache.interfaces.istorage) implementations. To add the reports controller to your application, follow the steps: 1. Add references to the following Telerik Reporting assemblies (required) and set their **Copy Local** properties to true in Visual Studio: @@ -23,38 +23,38 @@ This abstract class requires [IReportSourceResolver](/api/Telerik.Reporting.Serv 1. Add references to the following Telerik Reporting assemblies (optional) and set their **Copy Local** properties to true in Visual Studio: - - Telerik.Reporting.Cache.Database.dll - only if [DatabaseStorage](/api/Telerik.Reporting.Cache.Database.DatabaseStorage) caching mechanism is intended. For more details, check [Reporting REST Service Storage](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-service-storage/overview). The assembly has dependencies on Telerik Data Access, which can be checked in the version corresponding to [Upgrade article](slug:telerikreporting/upgrade/overview); + - Telerik.Reporting.Cache.Database.dll - only if [DatabaseStorage](/api/telerik.reporting.cache.database.databasestorage) caching mechanism is intended. For more details, check [Reporting REST Service Storage](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-service-storage/overview). The assembly has dependencies on Telerik Data Access, which can be checked in the version corresponding to [Upgrade article](slug:telerikreporting/upgrade/overview); - Telerik.Reporting.OpenXmlRendering.dll - depends on [Third-Party Dependencies](slug:telerikreporting/using-reports-in-applications/third-party-dependencies). Required if you need to export in OpenXML formats (DOCX, PPTX, XLSX); - Telerik.Reporting.XpsRendering.dll - required if you need to export in XPS format; - - Telerik.Reporting.Adomd.dll - required if you use [CubeDataSource](slug:telerikreporting/designing-reports/connecting-to-data/data-source-components/cubedatasource-component/overview) components in reports. The assembly has dependencies on _Microsoft.AnalysisServices.AdomdClient.dll_ v.10.0.0.0 or [above with proper binding redirects](slug:telerikreporting/designing-reports/connecting-to-data/data-source-components/cubedatasource-component/configuring-your-project-for-using-microsoft-analysis-services); + - Telerik.Reporting.Adomd.dll - required if you use [CubeDataSource](slug:telerikreporting/designing-reports/connecting-to-data/data-source-components/cubedatasource-component/overview) components in reports. The assembly has dependencies on `Microsoft.AnalysisServices.AdomdClient.dll` v.10.0.0.0 or [above with proper binding redirects](slug:telerikreporting/designing-reports/connecting-to-data/data-source-components/cubedatasource-component/configuring-your-project-for-using-microsoft-analysis-services); - > Without setting Telerik Reporting references' _Copy Local_ to true, the assemblies may not be loaded correctly when running the application. + > important Without setting Telerik Reporting references' **Copy Local** to true, the assemblies may not be loaded correctly when running the application. 1. Inherit this base class in your hosting application (usually in the Controllers folder of an MVC application). - **ReportsControllerBase configuration in code:** - Set the [ReportServiceConfiguration](/api/Telerik.Reporting.Services.WebApi.ReportsControllerBase#Telerik_Reporting_Services_WebApi_ReportsControllerBase_ReportServiceConfiguration) property. The **ReportSourceResolver** and **Storage** configuration settings are required. See the [IReportServiceConfiguration](/api/Telerik.Reporting.Services.IReportServiceConfiguration) interface for more details. + Set the [ReportServiceConfiguration](/api/telerik.reporting.services.webapi.reportscontrollerbase#telerik_reporting_services_webapi_reportscontrollerbase_reportserviceconfiguration) property. The `ReportSourceResolver` and `Storage` configuration settings are required. See the [IReportServiceConfiguration](/api/telerik.reporting.services.ireportserviceconfiguration) interface for more details. {{source=CodeSnippets\MvcCS\Controllers\ReportsController.cs region=ReportsControllerImplementation}} {{source=CodeSnippets\MvcVB\Controllers\ReportsController.vb region=ReportsControllerImplementation}} - > note Starting with the [2024 Q4 (18.3.24.1112)](https://www.telerik.com/support/whats-new/reporting/release-history/progress-telerik-reporting-2024-q4-18-3-24-1112), it is possible to define the [ReportServiceConfiguration](/api/Telerik.Reporting.Services.WebApi.ReportsControllerBase#Telerik_Reporting_Services_WebApi_ReportsControllerBase_ReportServiceConfiguration) with less code using the `AddTelerikReporting` extension method: + > note Starting with the [2024 Q4 (18.3.24.1112)](https://www.telerik.com/support/whats-new/reporting/release-history/progress-telerik-reporting-2024-q4-18-3-24-1112), it is possible to define the [ReportServiceConfiguration](/api/telerik.reporting.services.webapi.reportscontrollerbase#telerik_reporting_services_webapi_reportscontrollerbase_reportserviceconfiguration) with less code using the `AddTelerikReporting` extension method: {{source=CodeSnippets\MvcCS\Controllers\ReportsController.cs region=ReportsControllerImplementationMinimal}} {{source=CodeSnippets\MvcVB\Controllers\ReportsController.vb region=ReportsControllerImplementationMinimal}} - [ReportsControllerBase](/api/Telerik.Reporting.Services.WebApi.ReportsControllerBase) inherits [System.Web.Http.ApiController](https://learn.microsoft.com/en-us/dotnet/api/system.web.http.apicontroller?view=aspnet-webapi-5.2) and implements all necessary API actions. The provided sample implementation will resolve .trdx|.trdp report definitions from the Reports subfolder of the hosting ASP.NET application root. + [ReportsControllerBase](/api/telerik.reporting.services.webapi.reportscontrollerbase) inherits [System.Web.Http.ApiController](https://learn.microsoft.com/en-us/dotnet/api/system.web.http.apicontroller?view=aspnet-webapi-5.2) and implements all necessary API actions. The provided sample implementation will resolve .trdx|.trdp report definitions from the Reports subfolder of the hosting ASP.NET application root. Another option is to reference a reports library and provide a report [type assembly qualified name](https://learn.microsoft.com/en-us/dotnet/api/system.type.assemblyqualifiedname?view=net-7.0) from the service clients. > note Do not forget to add all necessary (i.e., referred from the report definitions) connection strings to the application configuration file. - > The above implementation uses the [FileStorage](/api/Telerik.Reporting.Cache.File.FileStorage) method in order to create a storage object instance. All Visual Studio item templates for adding the Reporting REST service use the default **FileStorage** constructor. The second overload of the FileStorage constructor allows you to specify a folder, and it is recommended for usage in a production environment. + > note The above implementation uses the [FileStorage](/api/telerik.reporting.cache.file.filestorage) method in order to create a storage object instance. All Visual Studio item templates for adding the Reporting REST service use the default `FileStorage` constructor. The second overload of the `FileStorage` constructor allows you to specify a folder, and it is recommended for usage in a production environment. - **ReportsControllerBase configuration in configuration file:** - To configure the Telerik Reporting REST service from the application configuration file, set the value of the [ReportServiceConfiguration](/api/Telerik.Reporting.Services.WebApi.ReportsControllerBase#Telerik_Reporting_Services_WebApi_ReportsControllerBase_ReportServiceConfiguration) property to an instance of the [ConfigSectionReportServiceConfiguration](/api/Telerik.Reporting.Services.ConfigSectionReportServiceConfiguration) class. + To configure the Telerik Reporting REST service from the application configuration file, set the value of the [ReportServiceConfiguration](/api/telerik.reporting.services.webapi.reportscontrollerbase#telerik_reporting_services_webapi_reportscontrollerbase_reportserviceconfiguration) property to an instance of the [ConfigSectionReportServiceConfiguration](/api/telerik.reporting.services.configsectionreportserviceconfiguration) class. {{source=CodeSnippets\MvcCS\Controllers\ReportsControllerConfigSection.cs region=ReportsControllerConfigSectionImplementation}} {{source=CodeSnippets\MvcVB\Controllers\ReportsControllerConfigSection.vb region=ReportsControllerConfigSectionImplementation}} diff --git a/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/how-to-self-host-telerik-reporting-rest-web-api.md b/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/how-to-self-host-telerik-reporting-rest-web-api.md index 36910ddce..6cf7218d6 100644 --- a/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/how-to-self-host-telerik-reporting-rest-web-api.md +++ b/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/how-to-self-host-telerik-reporting-rest-web-api.md @@ -10,24 +10,26 @@ position: 3 previous_url: /telerik-reporting-rest-host-http-service-using-self-hosting,/embedding-reports/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-web-api-implementation/how-to-self-host-telerik-reporting-rest-web-api --- -# Self-Hosting the Telerik Reporting REST Service Web API in a Console Application +# Self-Hosting the Telerik Reporting REST Web API -ASP.NET Web API does not require IIS. You can self-host a Web API in your own host process. This tutorial shows how to host a Telerik Reporting REST Web API inside a console application. For more information on the hosting options, see: [Hosting ASP.NET Web API](https://learn.microsoft.com/en-us/aspnet/web-api/overview/hosting-aspnet-web-api/) +ASP.NET Web API does not require IIS. You can self-host a Web API in your own host process. This tutorial shows how to host a Telerik Reporting REST Web API inside a console application. For more information on the hosting options, see [Hosting ASP.NET Web API](https://learn.microsoft.com/en-us/aspnet/web-api/overview/hosting-aspnet-web-api/). -## To create a self-hosted HTTP service, follow the steps below: +## Creating a Self-Hosted HTTP Service -1. On an elevated console (“Run as administrator”), execute the following command, for example, to allow the running user to listen on port 8080: +1. On an elevated console (**Run as administrator**), execute the following command, for example, to allow the running user to listen on port 8080: `netsh http add urlacl url=http://+:8080/ user=DOMAIN\user` -1. In Visual Studio, create a “Console Application” project -1. Install the [Microsoft.AspNet.WebApi.SelfHost 4.0.30506](https://www.nuget.org/packages/Microsoft.AspNet.WebApi.SelfHost/4.0.30506) NuGet package +1. In Visual Studio, create a **Console Application** project. +1. Install the [Microsoft.AspNet.WebApi.SelfHost 4.0.30506](https://www.nuget.org/packages/Microsoft.AspNet.WebApi.SelfHost/4.0.30506) NuGet package. - >The Reporting REST WebAPI Service is built against WebAPI 1. In case you have to use __newer version of Microsoft.AspNet.WebApi.SelfHost (e.g., WebAPI 2)__ you have to redirect the `System.Web.Http` and `System.Net.Http.Formatting` to their newer version. + > note > - >[Visual Studio NuGet Package Manager](https://docs.nuget.org/consume/installing-nuget) can add the required binding redirects automatically, if you update NuGet packages through it. + > The Reporting REST Web API Service is built against Web API 1. In case you have to use a **newer version of Microsoft.AspNet.WebApi.SelfHost (for example, Web API 2)**, you have to redirect the `System.Web.Http` and `System.Net.Http.Formatting` references to their newer version. > - >Alternatively, you add the following `bindingRedirects` to your `web.config` and replace `5.1.0.0` in the sample code below with the exact version: + > [Visual Studio NuGet Package Manager](https://docs.nuget.org/consume/installing-nuget) can add the required binding redirects automatically if you update NuGet packages through it. + > + > Alternatively, you can add the following `bindingRedirects` to your `App.config` and replace `5.1.0.0` in the sample code below with the exact version: > >```XML > @@ -56,16 +58,16 @@ ASP.NET Web API does not require IIS. You can self-host a Web API in your own ho + System.Net.Http.dll + System.Net.Http.Formatting.dll -1. Implement the reports controller as explained in the article [How to implement the ReportsController in an application](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-web-api-implementation/how-to-implement-the-reportscontroller-in-an-application) +1. Implement the reports controller as explained in the article [How to implement the ReportsController in an application](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-web-api-implementation/how-to-implement-the-reportscontroller-in-an-application). 1. Implement the starting point of the application: {{source=CodeSnippets\MvcCS\SelfHostedSnippets\Program.cs region=SelfHostedRestService}} {{source=CodeSnippets\MvcVB\SelfHostedSnippets\Program.vb region=SelfHostedRestService}} -1. Run the console app +1. Run the console application. 1. To verify whether the service works correctly, you can make a sample request for the available document formats using the following URL: - `http://localhost: [portnumber]/api/reports/formats` + `http://localhost:[portnumber]/api/reports/formats` If the request succeeds, you should receive the document formats encoded in JSON. For more information, see: [Get Available Document Formats](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-api-reference/general-api/get-available-document-formats). diff --git a/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/overview.md b/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/overview.md index f0ff2dee1..404cf2c01 100644 --- a/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/overview.md +++ b/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/overview.md @@ -12,7 +12,9 @@ previous_url: /telerik-reporting-rest-service-web-api,/embedding-reports/host-th # Telerik Reporting REST Service ASP.NET Web API Implementation -This implementation of the Reporting REST service is based on the [ASP.NET Web API framework](https://learn.microsoft.com/en-us/aspnet/web-api/). It is the Microsoft approach for building RESTful applications on the [.NET Framework](https://dotnet.microsoft.com/en-us/download/dotnet-framework). +This implementation of the Reporting REST Service is based on the [ASP.NET Web API framework](https://learn.microsoft.com/en-us/aspnet/web-api/). It is the Microsoft approach for building RESTful applications on the [.NET Framework](https://dotnet.microsoft.com/en-us/download/dotnet-framework). + +> note This article describes the **.NET Framework** flavor of the Reporting REST Service. For new projects targeting .NET (Core) and ASP.NET Core, see the [ASP.NET Core Web API Implementation Overview](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-core-web-api-implementation/overview) instead. ## Utilization @@ -21,11 +23,11 @@ You need to satisfy the following [Requirements](slug:telerikreporting/using-rep * [Adding Telerik Reporting REST Web API to Web Application](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-web-api-implementation/how-to-add-telerik-reporting-rest-web-api-to-web-application) * [Self Hosting Telerik Reporting REST Web API](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-web-api-implementation/how-to-self-host-telerik-reporting-rest-web-api) -Afterward follow this article to add the service entrance point: [How to implement the ReportsController in an application](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-web-api-implementation/how-to-implement-the-reportscontroller-in-an-application) +Afterward, follow this article to add the service entry point: [How to implement the ReportsController in an application](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-web-api-implementation/how-to-implement-the-reportscontroller-in-an-application). The service can be used from: -* [HTML5 Report Viewer](slug:telerikreporting/using-reports-in-applications/display-reports-in-applications/web-application/html5-report-viewer/overview) +* [HTML5 Report Viewer](slug:telerikreporting/using-reports-in-applications/display-reports-in-applications/web-application/html5-report-viewer/overview) * [Angular Report Viewer](slug:telerikreporting/using-reports-in-applications/display-reports-in-applications/web-application/angular-report-viewer/angular-report-viewer-overview) * [React Report Viewer](slug:telerikreporting/using-reports-in-applications/display-reports-in-applications/web-application/react-report-viewer/react-report-viewer-overview) * [Blazor ReportViewer](slug:telerikreporting/using-reports-in-applications/display-reports-in-applications/web-application/blazor-report-viewer/overview) diff --git a/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/requirements.md b/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/requirements.md index c59a4d770..9a8b420c8 100644 --- a/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/requirements.md +++ b/embedding-reports/host-the-report-engine-remotely/asp.net-web-api-implementation/requirements.md @@ -10,10 +10,10 @@ position: 1 previous_url: /telerik-reporting-rest-service-web-api-system-requirements,/embedding-reports/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-web-api-implementation/requirements --- -## Requirements for Using the Telerik Reporting REST WebAPI Service +# Requirements for Telerik Reporting REST Service ASP.NET Web API 1. Telerik Reports must be accessible by the application hosting the Reporting REST WebAPI service. -1. Telerik Reporting ASP.NET Web API service implementation requires the following ASP.NET and third-party assemblies. +1. Telerik Reporting ASP.NET Web API service implementation requires the following ASP.NET and third-party assemblies: - [Microsoft ASP.NET](https://learn.microsoft.com/en-us/aspnet/overview) 4.0 - System.Web.dll (4.0.0.0) @@ -23,11 +23,13 @@ previous_url: /telerik-reporting-rest-service-web-api-system-requirements,/embed - System.Web.Http.dll (4.0.0.0) - System.Web.Http.WebHost.dll (4.0.0.0) required for hosting in IIS - System.Web.Http.SelfHost.dll (4.0.0.0) required for Self-Hosting - - [Newtonsoft.Json.dll](https://www.newtonsoft.com/json) 13.0.0.0 (latest available via NuGet is recommended) You can use a newer WebAPI version by updating the corresponding (Microsoft.AspNet.WebApi.WebHost and Microsoft.AspNet.WebApi.SelfHost) NuGet packages and applying the following bindingRedirects to your application configuration file. Just replace `5.1.0.0` in the sample code below with the exact version: + - [Newtonsoft.Json.dll](https://www.newtonsoft.com/json) 13.0.0.0 (the latest version available via NuGet is recommended). + + You can use a newer Web API version by updating the corresponding `Microsoft.AspNet.WebApi.WebHost` and `Microsoft.AspNet.WebApi.SelfHost` NuGet packages and applying the following binding redirects to your application configuration file. Replace `5.1.0.0` in the sample code below with the exact version you are using: {{source=CodeSnippets\MvcCS\AssemblyBinding.xml}} -1. **_Optional assemblies_**: +1. **Optional assemblies**: These assemblies add up to the **Telerik Reporting Engine** functionality and should be used only if you need the specific feature. They are responsible for additional support formats or retrieving data from an OLAP cube. The assemblies must be deployed along with the application that hosts the **Telerik Reporting REST WebAPI Service**. - XPS rendering extension requires **Telerik.Reporting.XpsRendering** assembly (Telerik.Reporting.XpsRendering.dll). From 7828c84ff55b7cb1c8835781b54c74f84b6ababb Mon Sep 17 00:00:00 2001 From: Todor Arabadzhiev Date: Thu, 30 Apr 2026 17:49:45 +0300 Subject: [PATCH 5/8] Update how-to-implement-a-custom-report-source-resolver.md --- ...plement-a-custom-report-source-resolver.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/embedding-reports/host-the-report-engine-remotely/rest-service-report-source-resolver/how-to-implement-a-custom-report-source-resolver.md b/embedding-reports/host-the-report-engine-remotely/rest-service-report-source-resolver/how-to-implement-a-custom-report-source-resolver.md index 10525daed..161e4a49c 100644 --- a/embedding-reports/host-the-report-engine-remotely/rest-service-report-source-resolver/how-to-implement-a-custom-report-source-resolver.md +++ b/embedding-reports/host-the-report-engine-remotely/rest-service-report-source-resolver/how-to-implement-a-custom-report-source-resolver.md @@ -10,31 +10,31 @@ position: 1 previous_url: /telerik-reporting-rest-custom-report-resolver,/embedding-reports/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-service-report-source-resolver/how-to-implement-a-custom-report-source-resolver --- -# Steps for Implementing a Custom ReportSource Resolver +# Implementing a Custom ReportSource Resolver Explained with Example -This article explains how to create a custom report source resolver for the **Telerik Reporting REST service**. In this example, the resolver's purpose is to return a [XmlReportSource](/api/Telerik.Reporting.XmlReportSource) with an XML report definition obtained from an SQL Server database. +This article explains how to create a custom report source resolver for the **Telerik Reporting REST Service**. In this example, the resolver's purpose is to return an [XmlReportSource](/api/telerik.reporting.xmlreportsource) with an XML report definition obtained from a SQL Server database. > tip The report sources passed from the [Report Viewers using Reporting REST Service](slug:telerikreporting/using-reports-in-applications/display-reports-in-applications/how-to-set-reportsource-for-report-viewers#set-up-report-viewers-that-operate-via-telerik-reporting-services) and [Navigate To Report action](slug:telerikreporting/designing-reports/adding-interactivity-to-reports/actions/drillthrough-report-action) are resolved by the ReportSource Resolver of the service. The ReportSource of the [SubReport item](slug:telerikreporting/designing-reports/report-structure/subreport) is resolved in the context of the Reporting Engine and doesn't use the ReportSource Resolver of the REST Service. > > Use the ReportDocument Resolver to resolve them with custom code as explained in [Implementing Custom ReportSource and ReportDocument Resolvers To Fully Control the Report in Run Time](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-service-report-source-resolver/how-to-use-custom-report-source-resolver-and-custom-report-document-resolver). -1. Create a class which implements the [IReportSourceResolver](/api/Telerik.Reporting.Services.IReportSourceResolver) interface. Its [Resolve](/api/Telerik.Reporting.Services.IReportSourceResolver#Telerik_Reporting_Services_IReportSourceResolver_Resolve_System_String_Telerik_Reporting_Services_OperationOrigin_System_Collections_Generic_IDictionary{System_String_System_Object}_) method will be called whenever the engine needs to create a [ReportSource](/api/Telerik.Reporting.ReportSource) instance based on the parameter named _report_. The value of the _report_ parameter will be initialized with the value of the **Report** property of the report viewer's ReportSource object. +1. Create a class that implements the [IReportSourceResolver](/api/telerik.reporting.services.ireportsourceresolver) interface. Its [Resolve](/api/telerik.reporting.services.ireportsourceresolver#telerik_reporting_services_ireportsourceresolver_resolve_system_string_telerik_reporting_services_operationorigin_system_collections_generic_idictionary_system_string_system_object_) method is called whenever the engine needs to create a [ReportSource](/api/telerik.reporting.reportsource) instance based on the parameter named `report`. The value of the `report` parameter is initialized with the value of the **Report** property of the report viewer's `ReportSource` object. {{source=CodeSnippets\MvcCS\Controllers\CustomResolverReportsController.cs region=CustomReportResolver_Implementation}} {{source=CodeSnippets\MvcVB\Controllers\CustomResolverReportsController.vb region=CustomReportResolver_Implementation}} -1. Find the `ReportSourceResolver` property of the [ReportServiceConfiguration](/api/Telerik.Reporting.Services.WebApi.ReportsControllerBase#Telerik_Reporting_Services_WebApi_ReportsControllerBase_ReportServiceConfiguration), and set it to an instance of the custom report source resolver or to a chain of resolver instances, including the custom one. In the following examples, the REST Service will try to resolve the report in the sequence: +1. Find the `ReportSourceResolver` property of the [ReportServiceConfiguration](/api/telerik.reporting.services.webapi.reportscontrollerbase#telerik_reporting_services_webapi_reportscontrollerbase_reportserviceconfiguration), and set it to an instance of the custom report source resolver or to a chain of resolver instances, including the custom one. In the following examples, the REST Service tries to resolve the report in the sequence: - 1. Declarative report definition (`TRDP`/`TRDX`/`TRBP` file), through the `UriReportSourceResolver`; - 1. Type report definition (`CS` or `VB` type inheriting `Telerik.Reporting.Report`) through the `TypeReportSourceResolver`; + 1. Declarative report definition (`TRDP`/`TRDX`/`TRBP` file), through the `UriReportSourceResolver`. + 1. Type report definition (`CS` or `VB` type inheriting `Telerik.Reporting.Report`), through the `TypeReportSourceResolver`. 1. Custom report identifier, through the `CustomReportSourceResolver`. - - In `.NET Framework`, the property `ReportServiceConfiguration` is in the implementation of the [ReportsControllerBase](/api/Telerik.Reporting.Services.WebApi.ReportsControllerBase) class + - In .NET Framework, the `ReportServiceConfiguration` property is in the implementation of the [ReportsControllerBase](/api/telerik.reporting.services.webapi.reportscontrollerbase) class: {{source=CodeSnippets\MvcCS\Controllers\CustomResolverReportsController.cs region=CustomReportResolver_ReportsController_Implementation}} {{source=CodeSnippets\MvcVB\Controllers\CustomResolverReportsController.vb region=CustomReportResolver_ReportsController_Implementation}} - - In `.NET`, the `ReportServiceConfiguration` is usually added as a `Singleton` in the DI Container in the starting point of the application: + - In .NET, the `ReportServiceConfiguration` is usually added as a singleton in the DI container at the starting point of the application: {{source=CodeSnippets\Blazor\Docs\ProgramWithRestConfig.cs region=ReportsControllerRestFileStorageWithCustomReportSourceResolver}} @@ -46,27 +46,27 @@ This article explains how to create a custom report source resolver for the **Te {{source=CodeSnippets\Blazor\Docs\QueryCustomResolver.sql}} -1. To enter some data into the database, you can manually edit the **Reports** table. XML report definitions can be obtained from the sample **.trdx** report files installed together with the product and are located in **[Telerik_Reporting_Install_Dir]\Report Designer\Examples**. In newer versions, all sample reports of the Standalone Report Designer are in TRDP format. You can use the _Standalone Report Designer - File - Save As_ option to convert them to TRDX files. +1. To enter some data into the database, manually edit the **Reports** table. XML report definitions can be obtained from the sample `.trdx` report files installed together with the product and located in `[Telerik_Reporting_Install_Dir]\Report Designer\Examples`. In newer versions, all sample reports of the Standalone Report Designer are in TRDP format. Use the **Standalone Report Designer** > **File** > **Save As** option to convert them to TRDX files. -## How to implement and use custom IReportSourceResolver with fallback mechanism: +## How to Implement and Use a Custom IReportSourceResolver with a Fallback Mechanism -1. Add to your IReportSourceResolver implementation a constructor with the parameter IReportSourceResolver parentResolver. Then use the parentResolver if the custom report source resolving mechanism fails. +1. Add to your `IReportSourceResolver` implementation a constructor with the parameter `IReportSourceResolver parentResolver`. Then use the `parentResolver` if the custom report source resolving mechanism fails. {{source=CodeSnippets\MvcCS\Controllers\CustomResolverReportsController.cs region=CustomReportSourceResolverFallBack_Implementation}} {{source=CodeSnippets\MvcVB\Controllers\CustomResolverReportsController.vb region=CustomReportSourceResolverFallBack_Implementation}} -1. Add to the `ReportServiceConfiguration` the `IReportSourceResolver` implementations in a chain. Thus, the custom one will be executed first, if it fails the second one, and so on. +1. Add to the `ReportServiceConfiguration` the `IReportSourceResolver` implementations in a chain. Thus, the custom one is executed first, and if it fails, the second one is invoked, and so on. - - In `.NET Framework` the `ReportServiceConfiguration` is configured in the implementation of the [ReportsControllerBase](/api/Telerik.Reporting.Services.WebApi.ReportsControllerBase) class + - In .NET Framework, the `ReportServiceConfiguration` is configured in the implementation of the [ReportsControllerBase](/api/telerik.reporting.services.webapi.reportscontrollerbase) class: {{source=CodeSnippets\MvcCS\Controllers\CustomResolverReportsController.cs region=CustomResolverWithFallback_ReportsController_Implementation}} {{source=CodeSnippets\MvcVB\Controllers\CustomResolverReportsController.vb region=CustomResolverWithFallback_ReportsController_Implementation}} - - In `.NET`, the `ReportServiceConfiguration` is usually added as a `Singleton` in the DI Container at the starting point of the application: + - In .NET, the `ReportServiceConfiguration` is usually added as a singleton in the DI container at the starting point of the application: {{source=CodeSnippets\Blazor\Docs\ProgramWithRestConfig.cs region=ReportsControllerRestFileStorageWithCustomReportSourceResolverWithFallback}} - You can use for fallback the default IReportSourceResolver implementations: + For the fallback, you can use the default `IReportSourceResolver` implementations: - - TypeReportSourceResolver - Resolves IReportDocument from Assembly Qualified Name of a Report or ReportBook class - - UriReportSourceResolver - Resolves IReportDocument from the physical path to `TRDP`, `TRDX`, or `TRBP` file \ No newline at end of file + - `TypeReportSourceResolver`—resolves `IReportDocument` from the assembly-qualified name of a `Report` or `ReportBook` class. + - `UriReportSourceResolver`—resolves `IReportDocument` from the physical path to a `TRDP`, `TRDX`, or `TRBP` file. \ No newline at end of file From 9d3e92bf9a6e04cece52b5f9fab0140f2faafe9a Mon Sep 17 00:00:00 2001 From: Todor Arabadzhiev Date: Thu, 30 Apr 2026 18:08:56 +0300 Subject: [PATCH 6/8] Update overview.md --- .../overview.md | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/embedding-reports/host-the-report-engine-remotely/rest-service-report-source-resolver/overview.md b/embedding-reports/host-the-report-engine-remotely/rest-service-report-source-resolver/overview.md index 6c06b2cc7..24ea7f411 100644 --- a/embedding-reports/host-the-report-engine-remotely/rest-service-report-source-resolver/overview.md +++ b/embedding-reports/host-the-report-engine-remotely/rest-service-report-source-resolver/overview.md @@ -12,18 +12,18 @@ previous_url: /telerik-reporting-rest-service-report-resolver,/embedding-reports # REST Service ReportSource Resolver Overview -When implementing the ReportsController you need to provide an [IReportSourceResolver](/api/Telerik.Reporting.Services.IReportSourceResolver) implementation, which is used in the Reporting REST Service [ReportServiceConfiguration](/api/Telerik.Reporting.Services.WebApi.ReportsControllerBase#Telerik_Reporting_Services_WebApi_ReportsControllerBase_ReportServiceConfiguration) - __ReportSourceResolver property__. This article elaborates on the Reporting REST Service's ReportSourceResolver purpose, usage, built-in implementations and the option for adding a custom implementation. +When implementing the `ReportsController` you need to provide an [IReportSourceResolver](/api/telerik.reporting.services.ireportsourceresolver) implementation, which is used in the Reporting REST Service [ReportServiceConfiguration](/api/telerik.reporting.services.webapi.reportscontrollerbase#telerik_reporting_services_webapi_reportscontrollerbase_reportserviceconfiguration) - **ReportSourceResolver property**. This article elaborates on the Reporting REST Service's `ReportSourceResolver` purpose, usage, built-in implementations and the option for adding a custom implementation. ## Purpose and Usage of the Reporting REST Service ReportSource Resolver The Reporting REST Service's ReportSourceResolver handles reports on the server. -[IReportSourceResolver](/api/Telerik.Reporting.Services.IReportSourceResolver) defines the behavior of an object which takes a string as an argument and resolves it to a valid __server-side__ [ReportSource](slug:telerikreporting/designing-reports/report-sources/overview) object. The format of this string argument is a matter of implementation, which should contain rules for collaboration between the service clients and the report resolver on the server. For example, if the resolver implementation expects a string containing a path relative to the application root directory, then the client should send a string containing such a path. If the resolver is built to resolve reports from a type name, then a type name should be provided by the service client. Another scenario might require a resolver implementation that expects a report id and pulls the XML report definition from database storage by that report id, then returns it as an [XmlReportSource](/api/Telerik.Reporting.XmlReportSource). +[IReportSourceResolver](/api/telerik.reporting.services.ireportsourceresolver) defines the behavior of an object which takes a string as an argument and resolves it to a valid **server-side** [ReportSource](slug:telerikreporting/designing-reports/report-sources/overview) object. The format of this string argument is a matter of implementation, which should contain rules for collaboration between the service clients and the report resolver on the server. For example, if the resolver implementation expects a string containing a path relative to the application root directory, then the client should send a string containing such a path. If the resolver is built to resolve reports from a type name, then a type name should be provided by the service client. Another scenario might require a resolver implementation that expects a report id and pulls the XML report definition from database storage by that report id, then returns it as an [XmlReportSource](/api/telerik.reporting.xmlreportsource). The Reporting REST Service's resolver is used when resolving information for a report on the server, which includes: -* Getting information about the report's __ReportParameters__ collection; -* Returning a valid __server-side ReportSource__; +* Getting information about the report's **ReportParameters** collection; +* Returning a valid **server-side ReportSource**; * Applying client-side parameters' values; * Exporting the report in a selected format; * Printing the report which is based on export in PDF file with additional Adobe JavaScript settings - [Printing Reports](slug:telerikreporting/using-reports-in-applications/display-reports-in-applications/web-application/html5-report-viewer/printing-reports); @@ -32,16 +32,20 @@ The Reporting REST Service's resolver is used when resolving information for a r ## Available built-in ReportSource Resolver implementations: -1. [UriReportSourceResolver](/api/Telerik.Reporting.Services.UriReportSourceResolver) - resolves absolute path UriReportSource from absolute or relative path to declarative report definition files. These are the `TRDX`, `TRDP` or `TRBP` files created in the [Standalone Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/desktop-designers/standalone-report-designer/overview) or [Web Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/web-report-designer/overview). -1. [TypeReportSourceResolver](/api/Telerik.Reporting.Services.TypeReportSourceResolver) - resolves TypeReportSource from report type's [assembly qualified name](https://learn.microsoft.com/en-us/dotnet/api/system.type.assemblyqualifiedname?view=net-7.0) (reports created in Visual Studio Report Designer). +1. [UriReportSourceResolver](/api/telerik.reporting.services.urireportsourceresolver) - resolves absolute path UriReportSource from absolute or relative path to declarative report definition files. These are the `TRDX`, `TRDP` or `TRBP` files created in the [Standalone Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/desktop-designers/standalone-report-designer/overview) or [Web Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/web-report-designer/overview). +1. [TypeReportSourceResolver](/api/telerik.reporting.services.typereportsourceresolver) - resolves TypeReportSource from report type's [assembly qualified name](https://learn.microsoft.com/en-us/dotnet/api/system.type.assemblyqualifiedname?view=net-7.0) (reports created in Visual Studio Report Designer). -> When working with other types of report sources for which there is no built-in report source resolver implementation, use a [Custom ReportSource Resolver](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-service-report-source-resolver/how-to-implement-a-custom-report-source-resolver) implementation. For example, when using [Drillthrough Report Action](slug:telerikreporting/designing-reports/adding-interactivity-to-reports/actions/drillthrough-report-action) with [XmlReportSource](/api/Telerik.Reporting.XmlReportSource) the action will not work unless a custom report source resolver which can handle [XmlReportSource](/api/Telerik.Reporting.XmlReportSource) has been implemented. +> note +> +> When working with other types of report sources for which there is no built-in report source resolver implementation, use a [Custom ReportSource Resolver](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-service-report-source-resolver/how-to-implement-a-custom-report-source-resolver) implementation. For example, when using [Drillthrough Report Action](slug:telerikreporting/designing-reports/adding-interactivity-to-reports/actions/drillthrough-report-action) with [XmlReportSource](/api/telerik.reporting.xmlreportsource) the action will not work unless a custom report source resolver which can handle [XmlReportSource](/api/telerik.reporting.xmlreportsource) has been implemented. ## Custom ReportSource Resolver implementations: -Implementing the [IReportSourceResolver](/api/Telerik.Reporting.Services.IReportSourceResolver) interface allows you to include custom logic for creating, modifying, or accessing existing reports on the server, and to use any of the available [report sources](slug:telerikreporting/designing-reports/report-sources/overview). An example implementation is available in [How To Implement a Custom ReportSource Resolver](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-service-report-source-resolver/how-to-implement-a-custom-report-source-resolver). +Implementing the [IReportSourceResolver](/api/telerik.reporting.services.ireportsourceresolver) interface allows you to include custom logic for creating, modifying, or accessing existing reports on the server, and to use any of the available [report sources](slug:telerikreporting/designing-reports/report-sources/overview). An example implementation is available in [How To Implement a Custom ReportSource Resolver](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-service-report-source-resolver/how-to-implement-a-custom-report-source-resolver). -> The [Telerik.Reporting.Services.IReportSourceResolver.Resolve](/api/Telerik.Reporting.Services.IReportSourceResolver#Telerik_Reporting_Services_IReportSourceResolver_Resolve_System_String_Telerik_Reporting_Services_OperationOrigin_System_Collections_Generic_IDictionary{System_String_System_Object}_) method will be called each time when the Reporting engine needs the report source. This can happen several times until the report document is completely rendered. It is important that when the method is invoked multiple times it returns exactly the same report source for a given value of the passed string argument. +> important +> +> The [Telerik.Reporting.Services.IReportSourceResolver.Resolve](/api/telerik.reporting.services.ireportsourceresolver#telerik_reporting_services_ireportsourceresolver_resolve_system_string_telerik_reporting_services_operationorigin_system_collections_generic_idictionary{system_string_system_object}_) method will be called each time when the Reporting engine needs the report source. This can happen several times until the report document is completely rendered. It is important that when the method is invoked multiple times it returns exactly the same report source for a given value of the passed string argument. ## See Also From 1eb43ea3e57eac844279551543e3b03e80eb691c Mon Sep 17 00:00:00 2001 From: Todor Arabadzhiev Date: Thu, 30 Apr 2026 18:29:54 +0300 Subject: [PATCH 7/8] Update use-custom-report-source-and-document-resolvers.md --- ...om-report-source-and-document-resolvers.md | 94 ++++++++++--------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/embedding-reports/host-the-report-engine-remotely/rest-service-report-source-resolver/use-custom-report-source-and-document-resolvers.md b/embedding-reports/host-the-report-engine-remotely/rest-service-report-source-resolver/use-custom-report-source-and-document-resolvers.md index ed5176196..26b14e393 100644 --- a/embedding-reports/host-the-report-engine-remotely/rest-service-report-source-resolver/use-custom-report-source-and-document-resolvers.md +++ b/embedding-reports/host-the-report-engine-remotely/rest-service-report-source-resolver/use-custom-report-source-and-document-resolvers.md @@ -10,20 +10,25 @@ position: 2 previous_url: /telerik-reporting-rest-using-custom-report-resolver-and-document-resolver,/embedding-reports/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-service-report-source-resolver/use-custom-report-source-and-document-resolvers --- -# Implementing Custom ReportSource and ReportDocument Resolvers To Fully Control the Report at Run Time +# Implementing Custom ReportSource Resolver and Custom ReportDocument Resolver + +The article explains how you may fully control the report definition at runtime and set its data dynamically through custom code. Most of [Telerik Report Viewers](slug:telerikreporting/using-reports-in-applications/display-reports-in-applications/overview) utilize [Telerik Reporting REST Service](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/overview). They rely entirely on the latter to prepare and send the requested report documents. The Reporting engine is exposed by the REST Service, and all the work related to report processing and rendering is done by the engine. The purpose of this article is to elaborate on how the report source information sent by the viewer is resolved to an object that can be processed by the Reporting engine, and where and how the developer may customize this process. -> We recommend using the built-in tools for report customization that Telerik Reporting offers. These are ->* [Expressions](slug:telerikreporting/designing-reports/connecting-to-data/expressions/overview) ->* [Bindings](slug:telerikreporting/designing-reports/connecting-to-data/expressions/using-expressions/bindings) ->* [Conditional Formattings](slug:telerikreporting/designing-reports/styling-reports/conditional-formatting) - ->The above tools allow you to use a variety of [Global Objects](slug:telerikreporting/designing-reports/connecting-to-data/expressions/expressions-reference/global-objects) inside the report definition to modify its appearance at run-time. For example, based on the incoming data, [Report Parameter](slug:telerikreporting/designing-reports/connecting-to-data/report-parameters/overview) values and the logged-in user. In most of the reporting scenarios, these tools should let you achieve your goals without custom code. - ->One of the major benefits of this approach is the much easier upgrade and maintenance of the Reporting part of your application. Our [Upgrade Wizard](slug:telerikreporting/designing-reports/report-designer-tools/desktop-designers/visual-studio-report-designer/upgrade-wizard) takes care of all the code auto-generated by our report designers. The approach discussed in this article requires custom code that should be maintained manually. +> tip +> +> We recommend using the built-in tools for report customization that Telerik Reporting offers. These are: +> +> * [Expressions](slug:telerikreporting/designing-reports/connecting-to-data/expressions/overview) +> * [Bindings](slug:telerikreporting/designing-reports/connecting-to-data/expressions/using-expressions/bindings) +> * [Conditional Formatting](slug:telerikreporting/designing-reports/styling-reports/conditional-formatting) +> +> The above tools allow you to use a variety of [Global Objects](slug:telerikreporting/designing-reports/connecting-to-data/expressions/expressions-reference/global-objects) inside the report definition to modify its appearance at run time. For example, based on the incoming data, [Report Parameter](slug:telerikreporting/designing-reports/connecting-to-data/report-parameters/overview) values, and the logged-in user. In most reporting scenarios, these tools should let you achieve your goals without custom code. +> +> One of the major benefits of this approach is the much easier upgrade and maintenance of the Reporting part of your application. Our [Upgrade Wizard](slug:telerikreporting/designing-reports/report-designer-tools/desktop-designers/visual-studio-report-designer/upgrade-wizard) takes care of all the code auto-generated by our report designers. The approach discussed in this article requires custom code that must be maintained manually. Let's start with some theory before showing two basic examples. @@ -31,77 +36,77 @@ Let's start with some theory before showing two basic examples. The Report Viewer sends a [client-side reportSource](slug:telerikreporting/using-reports-in-applications/display-reports-in-applications/web-application/html5-report-viewer/api-reference/reportviewer/methods/reportsource()) to the REST Service. It is an object with two properties described next: -* The __string__ property __report__ +* The `string` property `report` This is the report identifier. Server-side, it will be used by the REST Service to identify the correct report definition to be used as a report template. -* The __parameters__ dictionary with __string__ keys and __object__ values +* The `parameters` dictionary with `string` keys and `object` values - The keys are the Report Parameter names, and the values are the corresponding values that need to be applied. The Reporting engine matches the parameter names specified in the report definition with the keys in the __parameters__ dictionary when applying the values. + The keys are the Report Parameter names, and the values are the corresponding values that need to be applied. The Reporting engine matches the parameter names specified in the report definition with the keys in the `parameters` dictionary when applying the values. -The Reporting engine requires a [server-side ReportSource](slug:telerikreporting/designing-reports/report-sources/overview) to generate a report document. How does it get it from the client-side reportSource sent to the REST Service? +The Reporting engine requires a [server-side ReportSource](slug:telerikreporting/designing-reports/report-sources/overview) to generate a report document. How does it get it from the client-side `reportSource` sent to the REST Service? -The answer is in the [ReportSource resolver](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-service-report-source-resolver/overview) that implements the interface [IReportSourceResolver](/api/Telerik.Reporting.Services.IReportSourceResolver). Its method __Resolve()__ is invoked with the __reportSource.report__ passed as the first argument to return the correct server-side ReportSource, supposed to be used by the Reporting engine. +The answer is in the [ReportSource resolver](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-service-report-source-resolver/overview) that implements the [IReportSourceResolver](/api/telerik.reporting.services.ireportsourceresolver) interface. Its `Resolve()` method is invoked with `reportSource.report` passed as the first argument and returns the server-side `ReportSource` to be used by the Reporting engine. -The rest of the arguments of the __Resolve()__ method contain important information that may be used effectively. Let's clarify the meaning and the intended usage of these additional arguments : +The rest of the arguments of the `Resolve()` method contain important information that may be used effectively. Let's clarify the meaning and the intended usage of these additional arguments: -* The [OperationOrigin](/api/Telerik.Reporting.Services.OperationOrigin) type __operationOrigin__ shows the purpose of the current call to the resolver. +* The [OperationOrigin](/api/telerik.reporting.services.operationorigin) parameter `operationOrigin` shows the purpose of the current call to the resolver. - The viewer makes several requests to the REST Service to let the user preview and select the desired parameter values for the report rendering, and then to display the requested report document. The first request that requires report resolving is [Get Report Parameters](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-api-reference/report-parameters-api/get-report-parameters). Its purpose is to check what parameters the report definition has and display the visible ones with their preset or default values. During this call to the Resolver, the __operationOrigin__ is set to __ResolveReportParameters__. + The viewer makes several requests to the REST Service to let the user preview and select the desired parameter values for the report rendering, and then to display the requested report document. The first request that requires report resolving is [Get Report Parameters](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-api-reference/report-parameters-api/get-report-parameters). Its purpose is to check what parameters the report definition has and display the visible ones with their preset or default values. During this call to the resolver, `operationOrigin` is set to `ResolveReportParameters`. - The second call to the resolver is in response to the [Resolve Report Instance](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-api-reference/report-instances-api/resolve-report-instance) request from the viewer. When successful, it results in the instantiation of the report definition. The __operationOrigin__ is set to __CreateReportInstance__. + The second call to the resolver is in response to the [Resolve Report Instance](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-api-reference/report-instances-api/resolve-report-instance) request from the viewer. When successful, it results in the instantiation of the report definition. The `operationOrigin` is set to `CreateReportInstance`. - The third call is associated with __operationOrigin__ equal to __GenerateReportDocument__ and is in response to the [Resolve Document](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-api-reference/documents-api/resolve-document) request from the viewer. This is when the rendering begins if the requested document is not found in the REST Service storage. Generally, each report document gets saved in the storage. If the client requests the same report with the same parameter values, the same interactivity state, and in the same rendering format, the report would be taken from the storage rather than being rendered again. + The third call is associated with `operationOrigin` equal to `GenerateReportDocument` and is in response to the [Resolve Document](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/rest-api-reference/documents-api/resolve-document) request from the viewer. This is when the rendering begins if the requested document is not found in the REST Service storage. Generally, each report document gets saved in the storage. If the client requests the same report with the same parameter values, the same interactivity state, and in the same rendering format, the report would be taken from the storage rather than being rendered again. - The __GetPageLayout__ value of the __operationOrigin__ is related to the PageSettings dialog of the viewers and is for internal use. + The `GetPageLayout` value of `operationOrigin` is related to the **Page Settings** dialog of the viewers and is for internal use. -* The __currentParameterValues__ dictionary contains the parameter values that would be applied when rendering the report. This is a dictionary with the values of the report parameters. You may access the values set on the client with all __operationOrigin__ calls. When opening the report for the first time with __operationOrigin__ equal to __OperationOrigin.ResolveReportParameters__, the __currentParameterValues__ returns only the parameter values set by the client/viewer. At this point, the report hasn't been resolved yet, and the default parameter values haven't been read from the report definition. Let's elaborate on handling the Report Parameter values. Generally, they may be set in three different places. +* The `currentParameterValues` dictionary contains the parameter values that would be applied when rendering the report. This is a dictionary with the values of the report parameters. You may access the values set on the client with all `operationOrigin` calls. When opening the report for the first time with `operationOrigin` equal to `OperationOrigin.ResolveReportParameters`, `currentParameterValues` returns only the parameter values set by the client/viewer. At this point, the report has not been resolved yet, and the default parameter values have not been read from the report definition. Let's elaborate on handling the Report Parameter values. Generally, they may be set in three different places: 1. In the report definition, when you prepare or modify it. These are the default values. - 1. On the client-side, the reportSource of the viewer. - 1. On the server side, the ReportSource returned by the REST Service. + 1. On the client side, in the `reportSource` of the viewer. + 1. On the server side, in the `ReportSource` returned by the REST Service. There are two approaches for modifying the parameter values in the ReportSource resolver: - + You may edit directly the dictionary __currentParameterValues__ during __OperationOrigin.ResolveReportParameters__ The changes will override all the settings, including the values passed from the viewer. If you add to the dictionary parameters that don't exist in the report definition during this call, they will be ignored later. The same is valid for the non-existing parameters added by the viewer. The reason is that when the report definition is identified/resolved, the Reporting engine matches the parameters passed with the ReportSource with the parameters in the report definition by name. Those that don't match the report definition parameters get ignored. The dictionary should not be changed during the rest of the calls, as this may lead to inconsistency of what is displayed in the viewer and the actual parameter values used during report processing, or even a failure in report generation. + + You may edit the `currentParameterValues` dictionary directly during `OperationOrigin.ResolveReportParameters`. The changes will override all the settings, including the values passed from the viewer. If you add parameters to the dictionary that do not exist in the report definition during this call, they will be ignored later. The same is valid for the non-existing parameters added by the viewer. The reason is that when the report definition is identified/resolved, the Reporting engine matches the parameters passed with the `ReportSource` with the parameters in the report definition by name. Those that don't match the report definition parameters get ignored. The dictionary should not be changed during the rest of the calls, as this may lead to inconsistency between what is displayed in the viewer and the actual parameter values used during report processing, or even a failure in report generation. - + Here is the priority of applying parameter values if you don't modify the __currentParameterValues__ dictionary directly. + + Here is the priority of applying parameter values if you do not modify the `currentParameterValues` dictionary directly. - If you pass any parameter values from the viewer, the Reporting engine will use them with the highest priority. For the values that are not provided, it will utilize the default parameter values from the report definition. In this case, any parameter values set in the ReportSource returned by the resolver will be ignored. For example, if the report has two parameters, 'Category' and 'Id', and you set only the 'Id' from the viewer, the 'Category' value would be taken from the report definition. If the default 'Category' value is not set in the definition, the viewer will display an exception message even if you set this value in the ReportSource returned by the resolver. + If you pass any parameter values from the viewer, the Reporting engine will use them with the highest priority. For the values that are not provided, it will utilize the default parameter values from the report definition. In this case, any parameter values set in the `ReportSource` returned by the resolver will be ignored. For example, if the report has two parameters, `Category` and `Id`, and you set only `Id` from the viewer, the `Category` value would be taken from the report definition. If the default `Category` value is not set in the definition, the viewer will display an exception message even if you set this value in the `ReportSource` returned by the resolver. - If you don't pass any parameter values from the viewer, the Reporting engine will use the values assigned to the server-side ReportSource Parameters collection set in the resolver during __OperationOrigin.ResolveReportParameters__ pass. If you provide them later, they will be ignored, and the values from the report definition will be used instead. + If you don't pass any parameter values from the viewer, the Reporting engine will use the values assigned to the server-side `ReportSource.Parameters` collection set in the resolver during the `OperationOrigin.ResolveReportParameters` pass. If you provide them later, they will be ignored, and the values from the report definition will be used instead. After this short introduction to the ReportSource resolver concept, we may demonstrate it in action with some sample implementations. ## How to assign a data source dynamically to a report and one of its data items -A common scenario that requires a custom ReportSource resolver is when you need to assign a data source dynamically to the report or other [data items](slug:telerikreporting/designing-reports/connecting-to-data/data-items/overview). In this case, it is necessary to instantiate the report definition, set the data source to the report (and/or other data items), and return the modified report definition instance wrapped in an [InstanceReportSource](/api/Telerik.Reporting.InstanceReportSource). +A common scenario that requires a custom ReportSource resolver is when you need to assign a data source dynamically to the report or other [data items](slug:telerikreporting/designing-reports/connecting-to-data/data-items/overview). In this case, it is necessary to instantiate the report definition, set the data source on the report (and/or other data items), and return the modified report definition instance wrapped in an [InstanceReportSource](/api/telerik.reporting.instancereportsource). Here is a sample code that demonstrates the approach: {{source=CodeSnippets\MvcCS\Controllers\MyReportSourceResolver.cs}} -For the particular scenario, we pass the reports folder in the constructor of the custom ReportSource resolver so that the latter may find the report definitions. We assume that the *reportId* is the report name, for example, 'MyReportName.trdp', that should be looked for in this folder. We unpackage the report definition and, on the proper request, add the data source to the report and to its table. +For the particular scenario, we pass the reports folder in the constructor of the custom ReportSource resolver so that it may find the report definitions. We assume that `reportId` is the report name, for example, `MyReportName.trdp`, that should be looked for in this folder. We unpackage the report definition and, on the proper request, add the data source to the report and to its table. -The server-side ReportSource that we return is *InstanceReportSource* with the modified report object. What deserves to be acknowledged here is that data source assignment, hence, the data fetching happens only when needed. +The server-side `ReportSource` that we return is an `InstanceReportSource` with the modified report object. What deserves to be acknowledged here is that data source assignment, and therefore the data fetching, happens only when needed. ## What happens next? -The server-side ReportSource, along with the parameter values, holds a reference to the report definition. +The server-side `ReportSource`, along with the parameter values, holds a reference to the report definition. -In the [UriReportSource](/api/Telerik.Reporting.UriReportSource), this is the physical path to the TRDP/TRDX report or TRBP report book and is held in the *Uri* property. +In the [UriReportSource](/api/telerik.reporting.urireportsource), this is the physical path to the TRDP/TRDX report or TRBP report book and is held in the `Uri` property. -For the [TypeReportSource](/api/Telerik.Reporting.TypeReportSource), this is the assembly-qualified name of the CLR report definition, for example, the CS report class inheriting from our base class [Report](/api/Telerik.Reporting.Report). It is in the *TypeName* property. +For the [TypeReportSource](/api/telerik.reporting.typereportsource), this is the assembly-qualified name of the CLR report definition, for example, the C# report class inheriting from our base class [Report](/api/telerik.reporting.report). It is held in the `TypeName` property. -The [InstanceReportSource](/api/Telerik.Reporting.InstanceReportSource) holds the report definition instance reference in its *ReportDocument* property. +The [InstanceReportSource](/api/telerik.reporting.instancereportsource) holds the report definition instance reference in its `ReportDocument` property. -And the [XmlReportSource](/api/Telerik.Reporting.XmlReportSource) has the XML of the report definition in its *Xml* property. This is the same XML that describes the report and can also be found in the TRDX report definition and inside the TRDP archive in the *definition.xml* file. +The [XmlReportSource](/api/telerik.reporting.xmlreportsource) holds the XML of the report definition in its `Xml` property. This is the same XML that describes the report and can also be found in the TRDX report definition and inside the TRDP archive in the `definition.xml` file. -From this reference to the report definition, the Reporting engine needs to extract an instance of the corresponding report. For example, from the Uri to the TRDP file, it needs to make a *Telerik.Reporting.Report* object. For this reason, it utilizes the [IReportDocumentResolver](/api/Telerik.Reporting.Services.IReportDocumentResolver) interface. There is a default implementation for each of the above ReportSource types. +From this reference to the report definition, the Reporting engine needs to extract an instance of the corresponding report. For example, from the `Uri` to the TRDP file, it needs to produce a `Telerik.Reporting.Report` object. For this reason, it utilizes the [IReportDocumentResolver](/api/telerik.reporting.services.ireportdocumentresolver) interface. There is a default implementation for each of the above `ReportSource` types. -For example, the document resolver for the *UriReportSource* utilizes the [ReportPackager](/api/Telerik.Reporting.ReportPackager) to instantiate the TRDP reports, and [ReportXmlSerializer](/api/Telerik.Reporting.XmlSerialization.ReportXmlSerializer) to deserialize the TRDX reports. +For example, the document resolver for `UriReportSource` utilizes [ReportPackager](/api/telerik.reporting.reportpackager) to instantiate the TRDP reports, and [ReportXmlSerializer](/api/telerik.reporting.xmlserialization.reportxmlserializer) to deserialize the TRDX reports. -In the REST Service, you may specify your own *IReportDocumentResolver* implementation. It should be set to the property __ReportDocumentResolver__ of the [ReportServiceConfiguration](/api/Telerik.Reporting.Services.ReportServiceConfiguration). Why did we introduce it? +In the REST Service, you may specify your own `IReportDocumentResolver` implementation. It should be set to the `ReportDocumentResolver` property of the [ReportServiceConfiguration](/api/telerik.reporting.services.reportserviceconfiguration). Why did we introduce it? The main reason was the way the [SubReports](slug:telerikreporting/designing-reports/report-structure/subreport) got resolved by the service. @@ -111,15 +116,16 @@ Imagine a main report and a subreport referenced inside it. When you use a Custo Let's consider a common scenario, where the main report definition XML would be fetched from a database. It contains a SubReport item with XML definition also held in the database. In addition, we need to set the data source at run time for both the main report and its subreport, and for a table in the subreport. -How would the Reporting engine resolve the subreport in this case? Usually, the subreport would be referenced in a SubReport item as a server-side ReportSource, for example, a TRDP report with a relative path. This would represent the most common scenario when the reports were designed with the Standalone or Web Report designer. In this case, the Reporting engine will try to resolve the subreport's UriReportSource in the context of the application. +How would the Reporting engine resolve the subreport in this case? Usually, the subreport would be referenced in a `SubReport` item as a server-side `ReportSource`, for example, a TRDP report with a relative path. This represents the most common scenario when the reports were designed with the Standalone or Web Report Designer. In this case, the Reporting engine will try to resolve the subreport's `UriReportSource` in the context of the application. -Importantly, the REST Service ReportSource resolver won't be involved as the SubReport processing happens as part of the main report processing. This means that the Reporting engine will look in a particular folder of the application, as it will use the default *IReportDocumentResolver* for the *UriReportSource*. This is fine in some cases. However, in the general scenario, you would like to keep all your reports in the database rather than keeping the main ones in the database and the subreports in a local folder. +Importantly, the REST Service ReportSource resolver will not be involved, as the `SubReport` processing happens as part of the main report processing. This means that the Reporting engine will look in a particular folder of the application, as it will use the default `IReportDocumentResolver` for the `UriReportSource`. This is fine in some cases. However, in the general scenario, you would like to keep all your reports in the database rather than keeping the main ones in the database and the subreports in a local folder. -For this common scenario, the custom implementation of the *IReportDocumentResolver* would let you resolve all the report documents in the same manner, for example, from the database. That said, the resolving of any server-side ReportSource *ReportDocument* would pass through this custom *IReportDocumentResolver* rather than through the default one for the corresponding ReportSource. This would let you, in the context of the example, fetch all of the report definitions as XML from the database and instantiate them through the *ReportXmlSerializer*. +For this common scenario, a custom implementation of `IReportDocumentResolver` lets you resolve all the report documents in the same manner—for example, from the database. That said, the resolving of any server-side `ReportSource.ReportDocument` would pass through this custom `IReportDocumentResolver` rather than through the default one for the corresponding `ReportSource`. In the context of the example, this would let you fetch all of the report definitions as XML from the database and instantiate them through the `ReportXmlSerializer`. -Here is a sample implementation of the *ReportSourceResolver* and the *ReportDocumentResolver* for the discussed scenario: +Here is a sample implementation of the `ReportSourceResolver` and the `ReportDocumentResolver` for the discussed scenario: {{source=CodeSnippets\MvcCS\Controllers\MyReportSourceResolverWithDocumentResolver.cs}} -We set the data source for the main report in the *IReportSourceResolver* implementation. The reason is that we can do this only once when generating the report document. Remember that the *Resolve* method of the *IReportSourceResolver* gets called several times during the communication between the viewer and the service. In each of them, the *IReportDocumentResolver* is also called when resolving the main report. Hence, if we set its data source in the *IReportDocumentResolver.Resolve* method, the data source would be set every time, which is overhead. -The resolving of the *SubReport.ReportSource*, on the other hand, happens once while processing the main report, and requires a single call to its *IReportDocumentResolver*. For that reason, we may set the subreport data source in the latter without worrying that this may decrease the performance. Note that since we assumed the *SubReport.ReportSource* is a *UriReportSource* in the main report definition, we need to fetch its XML based on the *Uri* property, deserialize it, set the data sources if necessary, and return the final modified report instance. +We set the data source for the main report in the `IReportSourceResolver` implementation. The reason is that we can do this only once when generating the report document. Remember that the `Resolve` method of `IReportSourceResolver` gets called several times during the communication between the viewer and the service. In each of them, `IReportDocumentResolver` is also called when resolving the main report. Hence, if we set its data source in the `IReportDocumentResolver.Resolve` method, the data source would be set every time, which is overhead. + +The resolving of the `SubReport.ReportSource`, on the other hand, happens once while processing the main report, and requires a single call to its `IReportDocumentResolver`. For that reason, we may set the subreport data source in the latter without worrying that this may decrease the performance. Note that since we assumed the `SubReport.ReportSource` is a `UriReportSource` in the main report definition, we need to fetch its XML based on the `Uri` property, deserialize it, set the data sources if necessary, and return the final modified report instance. From 80adae4379acd9b7351a2ddc08a8246c75703714 Mon Sep 17 00:00:00 2001 From: Todor Arabadzhiev Date: Thu, 30 Apr 2026 18:41:03 +0300 Subject: [PATCH 8/8] Update host-reports-service-in-.net-5.md --- .../host-reports-service-in-.net-5.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-5.md b/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-5.md index b69601e9d..0402d5a04 100644 --- a/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-5.md +++ b/embedding-reports/host-the-report-engine-remotely/asp.net-core-web-api-implementation/host-reports-service-in-.net-5.md @@ -3,7 +3,7 @@ title: Hosting in .NET with Main Method page_title: Hosting the Reporting REST Service in ASP.NET Core with Main Method description: "Learn how to configure the Telerik Reporting REST Service in an ASP.NET Core application in .NET through the Visual Studio project template or manually when providing the Reporting configuration in Startup.cs." slug: telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-core-web-api-implementation/how-to-host-reports-service-in-asp.net-core-in-.net-5 -tags: how,to,host,reports,service,in,asp.net,core,in,.net +tags: host, reports, service, asp.net, core, .net tag: updated published: True reportingArea: RESTServiceCore @@ -11,9 +11,9 @@ position: 3 previous_url: /telerik-reporting-rest-service-aspnetcore-net5,/embedding-reports/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-core-web-api-implementation/host-reports-service-in-.net-5 --- -# Hosting the Reporting REST Service in ASP.NET Core with Main Method +# Hosting the Reporting REST Service in ASP.NET Core with Startup.cs -This article guides you on how to host a Reports Web Service in order to expose the Reports Generation Engine to an ASP.NET Core in .NET Web Application. The configuration of the application in this tutorial is set up in the `Startup.cs` file of the project. +This article guides you on how to host a Reports Web Service to expose the Reports Generation Engine to an ASP.NET Core in a .NET Web Application. The configuration of the application in this tutorial is set up in the `Startup.cs` file of the project. If you prefer to use [top level statements introduced with .NET 6](https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/tutorials/top-level-statements), refer to the article [Hosting in .NET {{site.mindotnetversion}}+ with Top-Level Statements](slug:how-to-host-reports-service-in-aspnet-core-in-net-6-with-minimal-api). @@ -26,7 +26,7 @@ The guide is separated into sections for readability reasons. Along with the ste ## Using the REST Service Project Template -In Visual Studio open the **Add New Project** dialog and select _Telerik Reporting REST Service_ project template. After clicking `Create` a menu pops up that allows you to configure the following properties of the REST Service: target framework, service clients (report viewer and report designer), Cross-Origin Resource Sharing, Host Application ID, and Application URL. +In Visual Studio, open the **Add New Project** dialog and select the _Telerik Reporting REST Service_ project template. After clicking `Create`, a menu pops up that allows you to configure the following properties of the REST Service: target framework, service clients (report viewer and report designer), Cross-Origin Resource Sharing, Host Application ID, and Application URL. ![REST Service Project Configuration page from the Visual Studio project template for adding Telerik Reporting REST Service](images/rest-service-project-configuration-menu-net5.png) @@ -51,7 +51,7 @@ In this tutorial, the resulting service will use the sample report definitions d 1. Find the sample reports in _{Telerik Reporting installation path}\Report Designer\Examples_. 1. Add a new folder to your solution called `Reports` and copy all sample reports into it. -1. Later in the tutorial we will make sure that the ReportsController is able to resolve the definitions for the requested reports from this project folder. +1. Later in the tutorial, we will make sure that the ReportsController can resolve the definitions for the requested reports from this project folder. > It is recommended to use declarative definitions (TRDP/TRDX/TRBP) authored using the [Standalone Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/desktop-designers/standalone-report-designer/overview) or the [Web Report Designer](slug:telerikreporting/designing-reports/report-designer-tools/web-report-designer/overview) in order to take advantage of their design-time tooling because the VS integrated report designer tooling is still not available in .NET projects. @@ -62,17 +62,17 @@ This guide applies the recommended NuGet package references approach to add the 1. Reference the **Telerik.Reporting.Services.AspNetCore** package. 1. Optionally, to enable the Office OpenXML document formats (XLSX, DOCX, and PPTX) as export options, reference the **Telerik.Reporting.OpenXmlRendering** NuGet package. - The recommended way of adding the necessary dependencies is to use the [Progress Telerik proprietary NuGet feed](slug:telerikreporting/using-reports-in-applications/how-to-add-the-telerik-private-nuget-feed-to-visual-studio) and reference the dependencies as NuGet packages. This would also add the indirect dependencies to your project bringing easier dependency management. + The recommended way of adding the necessary dependencies is to use the [Progress Telerik proprietary NuGet feed](slug:telerikreporting/using-reports-in-applications/how-to-add-the-telerik-private-nuget-feed-to-visual-studio) and reference the dependencies as NuGet packages. This would also add the indirect dependencies to your project, bringing easier dependency management. - Alternatively, the assemblies are available in the `\Bin\net8.0\` and `\Bin\netstandard2.0\` folders of the Telerik Reporting installation directory. However, this would require to manually add all indirect dependencies listed in [.NET Support - Requirements](slug:telerikreporting/using-reports-in-applications/dot-net-core-support#requirements) section and also the following dependency package: [DocumentFormat.OpenXML version 2.7.2.0 or above](https://www.nuget.org/packages/DocumentFormat.OpenXml/). + Alternatively, the assemblies are available in the `\Bin\net8.0\` and `\Bin\netstandard2.0\` folders of the Telerik Reporting installation directory. However, this would require manually adding all indirect dependencies listed in [.NET Support - Requirements](slug:telerikreporting/using-reports-in-applications/dot-net-core-support#requirements) section and also the following dependency package: [DocumentFormat.OpenXML version 2.7.2.0 or above](https://www.nuget.org/packages/DocumentFormat.OpenXml/). - > note You need the last reference only to enable the Office OpenXML document formats. The Reporting engine relies on the [GDI+ API](https://learn.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-gdi-start) which is available on the Windows OS. On Linux and macOS we use the [SkiaSharp](https://github.com/mono/SkiaSharp) 2D Graphics Library based on Google's [Skia](https://skia.org/) Graphics Library. + > note You need the last reference only to enable the Office OpenXML document formats. The Reporting engine relies on the [GDI+ API](https://learn.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-gdi-start), which is available on the Windows OS. On Linux and macOS, we use the [SkiaSharp](https://github.com/mono/SkiaSharp) 2D Graphics Library based on Google's [Skia](https://skia.org/) Graphics Library. ### Setup the Startup.cs file for the Reports service > When the [Minimal API](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis) approach for hosting the Reporting REST Service is used, exceptions thrown by the service are propagated to and displayed in the Report Viewer. If this is undesired, set up the service using the 'Controllers' approach - [Hosting the Reporting REST Service in ASP.NET Core with Controllers](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-core-web-api-implementation/host-reports-service-in-.net-with-controllers). -The [`ConfigureServices`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.webhostbuilder.configureservices) method inside the `Startup.cs` file in the project should be modified in order to enable the Reports Service functionality. +The [`ConfigureServices`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.webhostbuilder.configureservices) method inside the `Startup.cs` file in the project should be modified to enable the Reports Service functionality. 1. Set up the [ReportServiceConfiguration](/api/telerik.reporting.services.reportserviceconfiguration) by invoking the `AddTelerikReporting` extension method on the [IMvcBuilder](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.dependencyinjection.imvcbuilder) object. In the code below, the first argument will represent the [HostAppId](/api/telerik.reporting.services.reportserviceconfiguration#telerik_reporting_services_reportserviceconfiguration_hostappid) of the [ReportServiceConfiguration](/api/telerik.reporting.services.reportserviceconfiguration) object, while the second is the path that will be passed to the [UriReportSourceResolver](/api/telerik.reporting.services.urireportsourceresolver): @@ -84,7 +84,7 @@ The [`ConfigureServices`](https://learn.microsoft.com/en-us/dotnet/api/microsoft ### Adding Connection Strings to the Configuration -The report generation engine can retrieve SQL Connection Strings and specific Report Generation Engine Settings that provide flexibility of the deployed application. It utilizes the [IConfiguration interface](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.configuration.iconfiguration) for this purpose. +The report generation engine can retrieve SQL Connection Strings and specific Report Generation Engine Settings that provide flexibility for the deployed application. It utilizes the [IConfiguration interface](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.configuration.iconfiguration) for this purpose. The .NET applications use a [key-value JSON-based](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/) file named by default `appSettings.json`. The default `ReportingEngineConfiguration` will be initialized from `appSettings.json` or `appsettings.{EnvironmentName}.json`. @@ -125,4 +125,4 @@ Activate the above policy for the application by adding the next code in the `Co * [Embedding Telerik Reporting in ASP.NET Core Web Reporting Applications](slug:asp-net-core-reporting) * [ASP.NET Core Web API Implementation Overview](slug:telerikreporting/using-reports-in-applications/host-the-report-engine-remotely/telerik-reporting-rest-services/asp.net-core-web-api-implementation/overview) -* [Hosting in .NET {{site.mindotnetversion}}+ with Minimal API](slug:how-to-host-reports-service-in-aspnet-core-in-net-6-with-minimal-api) \ No newline at end of file +* [Hosting in .NET {{site.mindotnetversion}}+ with Minimal API](slug:how-to-host-reports-service-in-aspnet-core-in-net-6-with-minimal-api)