Skip to content
Docs Try Aspire
Docs Try

Standalone Aspire dashboard sample app

Aspire sample

Clone, run, and explore this sample

View telemetry from any app in the Aspire dashboard. The dashboard supports running standalone, and apps configured with an OpenTelemetry SDK can send it data.

C#DashboardDockergRPCMetrics

This sample is a .NET console app that downloads data from NuGet. The app sends telemetry to the Aspire dashboard which is viewed in the dashboard telemetry UI.

  • How to run the Aspire dashboard from a Docker container
  • How to configure a .NET app to export telemetry to the dashboard
  • How to view telemetry in the Aspire dashboard

This sample is written in C# and targets .NET 10.0. It requires the .NET 10.0 SDK or later.

This sample runs the Aspire dashboard from a Docker container. It requires Docker to be installed.

The following command starts the Aspire dashboard in a Docker container:

Terminal window
docker run --rm -it -p 18888:18888 -p 4317:18889 -d --name aspire-dashboard mcr.microsoft.com/dotnet/aspire-dashboard:latest

The docker command:

  • Starts a container from the mcr.microsoft.com/dotnet/nightly/aspire-dashboard image.
  • The container has two ports:

Data displayed in the dashboard can be sensitive. By default, the dashboard is secured with authentication that requires a token to login.

When the dashboard is run from a standalone container the login token is printed to the container logs. After copying the highlighted token into the login page, select the Login button.

For more information about logging into the dashboard, see Dashboard authentication.

To download and run the sample, follow these steps:

  1. Clone the dotnet/aspire-samples repository.
  2. Navigate to the folder that holds the sample code.
  3. At the command line, type `dotnet run ConsoleApp.cs`.

Run the .NET app by executing the following at the command prompt (opened to the base directory of the sample):

Terminal window
dotnet run ConsoleApp.cs
  1. The console app launches, downloads information about the top NuGet packages and then exits.
  2. View the Aspire dashboard at http://localhost:18888 to see app telemetry.
    1. View structured logs to see the list of top NuGet packages.
    2. View traces to see HTTP requests made.
    3. View metrics to see numeric data about the app such as average HTTP request duration.

The telemetry export endpoint is configured with the OTEL_EXPORTER_OTLP_ENDPOINT setting. This value is set to http://localhost:4317 in the sample's ConsoleApp.run.json file. Removing the OTEL_EXPORTER_OTLP_ENDPOINT value disables exporting telemetry.

Preview

Sample screenshots

Select an image to zoom in.

Screenshot of the standalone Aspire dashboard
Screenshot of the standalone Aspire dashboard
Screenshot of the Aspire dashboard container logs
Screenshot of the Aspire dashboard container logs