Перейти к содержимому

AppHost configuration

Это содержимое пока не доступно на вашем языке.

The AppHost project configures and starts your distributed application. When a DistributedApplication runs it reads configuration from the AppHost. Configuration is loaded from environment variables that are set on the AppHost and DistributedApplicationOptions. Configuration includes:

  • Settings for hosting the resource service, such as the address and authentication options.
  • Settings used to start the Aspire dashboard, such the dashboard’s frontend and OpenTelemetry Protocol (OTLP) addresses.
  • Internal settings that Aspire uses to run the AppHost. These are set internally but can be accessed by integrations that extend Aspire.

AppHost configuration is provided by the AppHost launch profile. The AppHost has a launch settings file call launchSettings.json which has a list of launch profiles. Each launch profile is a collection of related options which defines how you would like dotnet to start your application.

launchSettings.json
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:17134;http://localhost:15170",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21030",
"ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22057"
}
}
}
}

The preceding launch settings file:

  • Has one launch profile named https.
  • Configures an Aspire AppHost project:
    • The applicationUrl property configures the dashboard launch address (ASPNETCORE_URLS).
    • Environment variables such as ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL and ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL are set on the AppHost.

For more information, see Launch profiles.

OptionDefault valueDescription
ASPIRE_ALLOW_UNSECURED_TRANSPORTfalseAllows communication with the AppHost without https. ASPNETCORE_URLS (dashboard address) and ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL (AppHost resource service address) must be secured with HTTPS unless true.
ASPIRE_CONTAINER_RUNTIMEdockerAllows the user of alternative container runtimes for resources backed by containers. Possible values are docker (default) or podman.
ASPIRE_VERSION_CHECK_DISABLEDfalseWhen set to true, Aspire doesn’t check for newer versions on startup.

When an Aspire app starts, it checks if a newer version of Aspire is available on NuGet. If a new version is found, a notification appears in the dashboard with the latest version number, a link to upgrade instructions, and button to ignore that version in the future.

Screenshot of dashboard showing a version update notification with upgrade options.

The version check runs only when:

  • The dashboard is enabled (interaction service is available).
  • At least 2 days have passed since the last check.
  • The check hasn’t been disabled via the ASPIRE_VERSION_CHECK_DISABLED configuration setting.
  • The app is not running in publish mode.

Updates are manual. You need to edit your project file to upgrade the Aspire SDK and package versions.

A resource service is hosted by the AppHost. The resource service is used by the dashboard to fetch information about resources which are being orchestrated by Aspire.

OptionDefault valueDescription
ASPIRE_RESOURCE_SERVICE_ENDPOINT_URLnullConfigures the address of the resource service hosted by the AppHost. Automatically generated with launchSettings.json to have a random port on localhost. For example, https://localhost:17037.
ASPIRE_DASHBOARD_RESOURCESERVICE_APIKEYAutomatically generated 128-bit entropy token.The API key used to authenticate requests made to the AppHost’s resource service. The API key is required if the AppHost is in run mode, the dashboard isn’t disabled, and the dashboard isn’t configured to allow anonymous access with ASPIRE_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS.

By default, the dashboard is automatically started by the AppHost. The dashboard supports its own set of configuration, and some settings can be configured from the AppHost.

OptionDefault valueDescription
ASPNETCORE_URLSnullDashboard address. Must be https unless ASPIRE_ALLOW_UNSECURED_TRANSPORT or DistributedApplicationOptions.AllowUnsecuredTransport is true. Automatically generated with launchSettings.json to have a random port on localhost. The value in launch settings is set on the applicationUrls property.
ASPNETCORE_ENVIRONMENTProductionConfigures the environment the dashboard runs as. For more information, see Use multiple environments in ASP.NET Core.
ASPIRE_DASHBOARD_OTLP_ENDPOINT_URLhttp://localhost:18889 if no gRPC endpoint is configured.Configures the dashboard OTLP gRPC address. Used by the dashboard to receive telemetry over OTLP. Set on resources as the OTEL_EXPORTER_OTLP_ENDPOINT env var. The OTEL_EXPORTER_OTLP_PROTOCOL env var is grpc. Automatically generated with launchSettings.json to have a random port on localhost.
ASPIRE_DASHBOARD_OTLP_HTTP_ENDPOINT_URLnullConfigures the dashboard OTLP HTTP address. Used by the dashboard to receive telemetry over OTLP. If only ASPIRE_DASHBOARD_OTLP_HTTP_ENDPOINT_URL is configured then it is set on resources as the OTEL_EXPORTER_OTLP_ENDPOINT env var. The OTEL_EXPORTER_OTLP_PROTOCOL env var is http/protobuf.
ASPIRE_DASHBOARD_CORS_ALLOWED_ORIGINSnullOverrides the CORS allowed origins configured in the dashboard. This setting replaces the default behavior of calculating allowed origins based on resource endpoints.
ASPIRE_DASHBOARD_FRONTEND_BROWSERTOKENAutomatically generated 128-bit entropy token.Configures the frontend browser token. This is the value that must be entered to access the dashboard when the auth mode is BrowserToken. If no browser token is specified then a new token is generated each time the AppHost is launched.
ASPIRE_DASHBOARD_TELEMETRY_OPTOUTfalseConfigures the dashboard to never send usage telemetry.
ASPIRE_DASHBOARD_AI_DISABLEDfalseGitHub Copilot in the dashboard is available when the AppHost is launched by a supported IDE. When set to true Copilot is disabled in the dashboard and no Copilot UI is visible.
ASPIRE_DASHBOARD_FORWARDEDHEADERS_ENABLEDfalseEnables the Forwarded headers middleware that replaces the scheme and host values on the Request context with the values coming from the X-Forwarded-Proto and X-Forwarded-Host headers.

Internal settings are used by the AppHost and integrations. Internal settings aren’t designed to be configured directly.

OptionDefault valueDescription
AppHost:DirectoryThe content root if there’s no project.Directory of the project where the AppHost is located. Accessible from the IDistributedApplicationBuilder.AppHostDirectory.
AppHost:PathThe directory combined with the application name.The path to the AppHost. It combines the directory with the application name.
AppHost:Sha256It is created from the AppHost name when the AppHost is in publish mode. Otherwise it is created from the AppHost path.Hex encoded hash for the current application. The hash is based on the location of the app on the current machine so it is stable between launches of the AppHost.
AppHost:OtlpApiKeyAutomatically generated 128-bit entropy token.The API key used to authenticate requests sent to the dashboard OTLP service. The value is present if needed: the AppHost is in run mode, the dashboard isn’t disabled, and the dashboard isn’t configured to allow anonymous access with ASPIRE_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS.
AppHost:BrowserTokenAutomatically generated 128-bit entropy token.The browser token used to authenticate browsing to the dashboard when it is launched by the AppHost. The browser token can be set by ASPIRE_DASHBOARD_FRONTEND_BROWSERTOKEN. The value is present if needed: the AppHost is in run mode, the dashboard isn’t disabled, and the dashboard isn’t configured to allow anonymous access with ASPIRE_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS.
AppHost:ResourceService:AuthModeApiKey. If ASPIRE_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS is true then the value is Unsecured.The authentication mode used to access the resource service. The value is present if needed: the AppHost is in run mode and the dashboard isn’t disabled.
AppHost:ResourceService:ApiKeyAutomatically generated 128-bit entropy token.The API key used to authenticate requests made to the AppHost’s resource service. The API key can be set by ASPIRE_DASHBOARD_RESOURCESERVICE_APIKEY. The value is present if needed: the AppHost is in run mode, the dashboard isn’t disabled, and the dashboard isn’t configured to allow anonymous access with ASPIRE_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS.
Вопросы & ответыСотрудничатьСообществоОбсуждатьСмотреть