Skip to main content
All docs
V24.2

Integrate .NET Aspire Dashboard into Web Reporting Apps

  • 3 minutes to read

.NET Aspire allows you to track various aspects of your app, including logs, traces, and environment configurations, in real-time. You can use the .NET Aspire Dashboard to monitor DevExpress Reports performance: track metrics, review traces, and access structured logs associated with document creation operations.

This topic describes how to integrate a .NET Aspire Dashboard into an ASP.NET Core Document Viewer application.

View Example: Reporting for Web - Integrate .NET Aspire Dashboard to the ASP.NET Core Reporting App

Prerequisites

To work with .NET Aspire, you need the following:

Add DevExpress NuGet Packages

Reference the following NuGet packages in your Reporting application:

  • DevExpress.Aspire.Reporting
  • DevExpress.Aspire.AspNetCore.Reporting

Add Your DevExpress Reports-Powered Application to a .NET Aspire Solution

Add the following project references:

Project Reference
AppHost/Orchestration project (usually with an *.AppHost suffix) DevExpress Reports application
DevExpress Reports application ServiceDefaults application

Open your reporting project. Add the following method calls to Program.cs:

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDevExpressControls();
// Important note: Enable .NET Aspire integration after an AddDevExpressControls method call
// Enable service discovery and configure OpenTelemetry metrics and tracing for .NET Aspire.
// Learn more at: https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/service-defaults
builder.AddServiceDefaults();

// Share trace data with the .NET Aspire Dashboard from DevExpress Reports document creation and exporting
builder.AddReporting();
// Share trace and metrics data with the .NET Aspire Dashboard for the DevExpress Reports back end services
builder.AddAspNetCoreReporting();

Navigate to the AppHost project. Add the following project reference code to Program.cs:

var builder = DistributedApplication.CreateBuilder(args);

builder.AddProject<Projects.DevExpressReportingApp>("webreporting")
  .WithExternalHttpEndpoints();

builder.Build().Run();

Tip

You can also add .NET Aspire to an existing Reporting app. Refer to the following tutorial for more information: Tutorial: Add .NET Aspire to an existing .NET app

Manage Metrics and Tracing

You can use AspNetCoreReportingSettings properties to deactivate metrics and tracing. Specify these properties in the reporting project’s appSettings.json file, in the Aspire section:

"Aspire": {
    "DevExpress": {
        "Reporting": {
            "AspNetCore": {
                "DisableMetrics": true,
                "DisableTracing": true
            },
            "DisableTracing": true
        }
    }
}

Run the Application

Build and run the *.AppHost solution to view output in the .NET Aspire dashboard.

start screen

.NET Aspire Dashboard Metrics Overview

The .NET Aspire dashboard allows you to view the following diagnostic information:

Traces

The Traces tab allows you to examine request details, including operational duration/name. Select the “webreporting” resource from the drop-down to view all requests made by the DevExpress Web Report Viewer. Each request may include multiple steps. The report first populates the data source, then evaluates data binding, builds pages, exports data, and so on. You can expand the request node to see an outline of these individual steps.

image

Select the node that says CachedDocumentBuilderAsync.DocumentCreation.NewTask. View details to find the ID of a recently created document.

image

Metrics
The Metrics tab displays Reports-related activity log. Use the log to find the following information:
  • The number of cached documents within a specific time frame
  • The time when a document was released from cache
  • The number of exported documents

Use the filter on the right to check if a specific document or export result is still consuming application memory.

Reporting and .NET Aspire Metrics tab

Logs

The Logs tab displays all built-in structured logs. Filter the grid against the DevExpress.AspNetCore.Reporting.Logger category to view reporting-related logs.

image