New to Telerik ReportingStart a free 30-day trial

Configuring an MSSQL Database Storage for the Reporting REST Service

This article explains how to configure an MSSQL Database for the Reporting REST Service storage.

Storage Setup

Before an MSSQL Server database can be used by the Reporting REST Service, the service-related tables and stored procedures must be added to it.

You may use a dedicated database or a shared database for both application data and Reporting REST Service Storage.

The following steps will walk you through the process of preparing the database for the Reporting REST Service:

  1. Start the Telerik Database Cache Configurator tool located in the {Telerik Reporting installation folder}/Tools folder.
  2. In the Choose database usage combo-box, select the "Configure REST service storage database" option.
  3. In the Choose target backend combo-box, select the "Microsoft SQL Server" option.
  4. In the Specify connection string text box, enter the connection string that references the target database. You can also click the Build button and create the connection string using the Connection properties form.
  5. Click on the Create schema button to start the database schema creation.
  6. A message box should be displayed, confirming that the storage tables are successfully created. Use the connection string specified above when initializing an instance of MsSqlServerStorage in your application.
  7. In case you want to clean up the storage tables in an existing database, use the button Clear cache data.

Project Setup

The Reporting REST Service can be set up to use the database storage by using one of the following approaches:

Here are samples for both scenarios when targeting .NET Framework or .NET:

Option 1 - Runtime via the ReportServiceConfiguration

The connection string that the service will use to connect to the database can be provided through code when passing a ReportServiceConfiguration instance to the Reporting REST Service.

The ReportSourceResolver and Storage configuration settings are required. See the IReportServiceConfiguration interface for more details.

  • .NET Framework 4.6.2+

    C#
    public class MSSqlReportsController : ReportsControllerBase
    {
        static readonly ReportServiceConfiguration configurationInstance =
            new ReportServiceConfiguration
            {
                HostAppId = "Application1",
                ReportSourceResolver = new UriReportSourceResolver(HttpContext.Current.Server.MapPath("~/Reports"))
                    .AddFallbackResolver(new TypeReportSourceResolver()),
                Storage = new Telerik.Reporting.Cache.MsSqlServerStorage("Data Source=(local)\\SQLEXPRESS;Initial Catalog=RestServiceStorage;Integrated Security=SSPI"),
            };
    
        public MSSqlReportsController()
        {
            this.ReportServiceConfiguration = configurationInstance;
        }
    }
  • .NET 8+

    C#
    builder.Services.TryAddSingleton<IReportServiceConfiguration>(sp =>
            new ReportServiceConfiguration
            {
                // The default ReportingEngineConfiguration will be initialized from appsettings.json or appsettings.{EnvironmentName}.json:
                ReportingEngineConfiguration = sp.GetService<IConfiguration>(),
    
                HostAppId = "Application1",
                Storage = new Telerik.Reporting.Cache.MsSqlServerStorage("Data Source=(local)\\SQLEXPRESS;Initial Catalog=RestServiceStorage;Integrated Security=SSPI"),
                ReportSourceResolver = new TypeReportSourceResolver()
                                        .AddFallbackResolver(new UriReportSourceResolver(reportsPath))
            });

Option 2 - Runtime via the Configuration

Pass a ConfigSectionReportServiceConfiguration instance to the Reporting REST Service:

  • .NET Framework 4.6.2+

    C#
    public class ReportsController : ReportsControllerBase
    {
        static Telerik.Reporting.Services.ConfigSectionReportServiceConfiguration configSectionConfigurationInstance =
            new Telerik.Reporting.Services.ConfigSectionReportServiceConfiguration()
            {
                HostAppId = "Application1",
                ReportSourceResolver = new UriReportSourceResolver(HttpContext.Current.Server.MapPath("~/Reports"))
                    .AddFallbackResolver(new TypeReportSourceResolver()),
                Storage = new Telerik.Reporting.Cache.MsSqlServerStorage("Data Source=(local)\\SQLEXPRESS;Initial Catalog=RestServiceStorage;Integrated Security=SSPI"),
            };
    
        public ReportsController()
        {
            this.ReportServiceConfiguration = configSectionConfigurationInstance;
        }
    }
  • .NET 8+

    C#
    Telerik.Reporting.Services.ConfigSectionReportServiceConfiguration configSectionConfigurationInstance =
                new Telerik.Reporting.Services.ConfigSectionReportServiceConfiguration()
                {
                    HostAppId = "Application1",
                    Storage = new Telerik.Reporting.Cache.MsSqlServerStorage("Data Source=(local)\\SQLEXPRESS;Initial Catalog=RestServiceStorage;Integrated Security=SSPI"),
                    ReportSourceResolver = new TypeReportSourceResolver()
                                            .AddFallbackResolver(new UriReportSourceResolver(reportsPath))
                };
    builder.Services.TryAddSingleton<IReportServiceConfiguration>(configSectionConfigurationInstance);

The properties from the ConfigSectionReportServiceConfiguration initialization block would override the values obtained from the configuration files below.

Option 3 - Configuration File

Set the corresponding property values in the REST Service configuration file:

  • .NET Framework 4.6.2+

    XML configuration (web.config):

    XML
    <configuration>
      <configSections>
        <section name="Telerik.Reporting" type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting" allowLocation="true" allowDefinition="Everywhere" />
      </configSections>
      <Telerik.Reporting>
        <restReportService hostAppId="Application1" workerCount="4" reportSharingTimeout="10" clientSessionTimeout="10" exceptionsVerbosity="detailed">
          <reportResolver provider="type" />
          <storage provider="MSSQLServer">
            <parameters>
              <parameter name="connectionString" value="Data Source=(local)\SQLEXPRESS;Initial Catalog=RestServiceStorage;Integrated Security=SSPI" />
              <parameter name="commandTimeout" value="60" />
            </parameters>
          </storage>
        </restReportService>
      </Telerik.Reporting>
    </configuration>
  • .NET 8+

    JSON configuration file (appsettings.json):

    JSON
    "telerikReporting": {
      "restReportService": {
        "hostAppId": "Application1",
        "reportResolver": {
          "provider": "type"
        },
        "storage": {
          "provider": "MSSQLServer",
          "parameters": [
            {
              "name": "connectionString",
              "value": "Data Source=(local)\\SQLEXPRESS;Initial Catalog=RestServiceStorage;Integrated Security=SSPI"
            },
            {
              "name": "commandTimeout",
              "value": 60
            }
          ]
        }
      }
    }

Since the 2025 Q1 (19.0.25.211) release, the MSSQL storage relies on System.Data.SqlClient to connect to the provided database in .NET Framework applications, and on Microsoft.Data.SqlClient in .NET applications. In previous versions, the System.Data.SqlClient data provider was used for each target framework.

See Also