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.
Prerequisites
To work with .NET Aspire, you need the following:
- .NET 8.0 or .NET 9.0
- .NET Aspire SDK
- Visual Studio 2022 version 17.9+
- .NET Aspire Dashboard application. Refer to the following help topic for information on how to create the application: Quick Start: Build your first .NET Aspire solution
- DevExpress Reports-powered application. Refer to the following section for tutorials on how to create an ASP.NET Core Report Viewer: Use Reporting Components
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.
.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.
Select the node that says CachedDocumentBuilderAsync.DocumentCreation.NewTask. View details to find the ID of a recently created document.
- 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.
- 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.