xtrareports-405257-net-aspire-integration.md
.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
To work with .NET Aspire, you need the following:
Reference the following NuGet packages in your Reporting application:
DevExpress.Aspire.ReportingDevExpress.Aspire.AspNetCore.ReportingAdd 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
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
}
}
}
Build and run the *.AppHost solution to view output in the .NET Aspire dashboard.
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.
MetricsThe Metrics tab displays Reports-related activity log. Use the log to find the following information:
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.