diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5b67e932fc..ed86086822 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -52,6 +52,17 @@ updates: dotnet: patterns: - "*" # Prefer a single PR per solution update. + - package-ecosystem: "nuget" + directory: "/docs/frameworks/snippets/Orleans" #OrleansClientServer.sln + schedule: + interval: "weekly" + day: "wednesday" + open-pull-requests-limit: 5 + groups: + # Group .NET updates together for solutions. + dotnet: + patterns: + - "*" # Prefer a single PR per solution update. - package-ecosystem: "nuget" directory: "/docs/fundamentals/snippets/components/AspireApp" #AspireApp.sln schedule: @@ -261,6 +272,61 @@ updates: dotnet: patterns: - "*" # Prefer a single PR per project update. + - package-ecosystem: "nuget" + directory: "/docs/frameworks/snippets/Orleans/OrleansAppHost" #OrleansAppHost.csproj + schedule: + interval: "weekly" + day: "wednesday" + open-pull-requests-limit: 5 + groups: + # Group .NET updates together for projects. + dotnet: + patterns: + - "*" # Prefer a single PR per project update. + - package-ecosystem: "nuget" + directory: "/docs/frameworks/snippets/Orleans/OrleansClient" #OrleansClient.csproj + schedule: + interval: "weekly" + day: "wednesday" + open-pull-requests-limit: 5 + groups: + # Group .NET updates together for projects. + dotnet: + patterns: + - "*" # Prefer a single PR per project update. + - package-ecosystem: "nuget" + directory: "/docs/frameworks/snippets/Orleans/OrleansContracts" #OrleansContracts.csproj + schedule: + interval: "weekly" + day: "wednesday" + open-pull-requests-limit: 5 + groups: + # Group .NET updates together for projects. + dotnet: + patterns: + - "*" # Prefer a single PR per project update. + - package-ecosystem: "nuget" + directory: "/docs/frameworks/snippets/Orleans/OrleansServer" #OrleansServer.csproj + schedule: + interval: "weekly" + day: "wednesday" + open-pull-requests-limit: 5 + groups: + # Group .NET updates together for projects. + dotnet: + patterns: + - "*" # Prefer a single PR per project update. + - package-ecosystem: "nuget" + directory: "/docs/frameworks/snippets/Orleans/OrleansServiceDefaults" #OrleansServiceDefaults.csproj + schedule: + interval: "weekly" + day: "wednesday" + open-pull-requests-limit: 5 + groups: + # Group .NET updates together for projects. + dotnet: + patterns: + - "*" # Prefer a single PR per project update. - package-ecosystem: "nuget" directory: "/docs/fundamentals/snippets/components/AspireApp/AspireApp.AppHost" #AspireApp.AppHost.csproj schedule: @@ -492,28 +558,6 @@ updates: dotnet: patterns: - "*" # Prefer a single PR per project update. - - package-ecosystem: "nuget" - directory: "/docs/real-time/snippets/signalr/SignalR.AppHost" #SignalR.AppHost.csproj - schedule: - interval: "weekly" - day: "wednesday" - open-pull-requests-limit: 5 - groups: - # Group .NET updates together for projects. - dotnet: - patterns: - - "*" # Prefer a single PR per project update. - - package-ecosystem: "nuget" - directory: "/docs/real-time/snippets/signalr/SignalR.ServiceDefaults" #SignalR.ServiceDefaults.csproj - schedule: - interval: "weekly" - day: "wednesday" - open-pull-requests-limit: 5 - groups: - # Group .NET updates together for projects. - dotnet: - patterns: - - "*" # Prefer a single PR per project update. - package-ecosystem: "nuget" directory: "/docs/real-time/snippets/signalr/SignalR.Web" #SignalR.Web.csproj schedule: diff --git a/docs/caching/caching-components-deployment.md b/docs/caching/caching-components-deployment.md new file mode 100644 index 0000000000..1dabd3dd66 --- /dev/null +++ b/docs/caching/caching-components-deployment.md @@ -0,0 +1,157 @@ +--- +title: Deploy a .NET Aspire app that connects to Redis Cache to Azure +description: Learn how to deploy a .NET Aspire app that connects to Redis Cache to Azure +ms.date: 05/12/2024 +ms.topic: how-to +--- + +# Tutorial: Deploy a .NET Aspire app with a Redis Cache to Azure + +In this tutorial, you learn to configure a .NET Aspire app with a Redis Cache for deployment to Azure. .NET Aspire provides multiple caching component configurations that provision different Redis services in Azure. You'll learn how to: + +> [!div class="checklist"] +> +> - Configure the app to provision an Azure Cache for Redis +> - Configure the app to provision a containerized Redis Cache + +> [!NOTE] +> This document focuses specifically on .NET Aspire configurations to provision and deploy Redis Cache resources in Azure. For more information and to learn more about the full .NET Aspire deployment process, see the [Azure Container Apps deployment](/dotnet/aspire/deployment/azure/aca-deployment?pivots=azure-azd) tutorial. + +[!INCLUDE [aspire-prereqs](../includes/aspire-prereqs.md)] + +## Create the sample solution + +Follow the [Tutorial: Implement caching with .NET Aspire components](./caching-components.md) to create the sample project. + +## Configure the app for Redis cache deployment + +.NET Aspire provides two built-in configuration options to streamline Redis Cache deployment on Azure: + +- Provision a containerized Redis Cache using Azure Container Apps +- Provision an Azure Cache for Redis instance + +### Add the .NET Aspire component to the app + +Add the appropriate .NET Aspire component to the _AspireRedis.AppHost_ project for your desired hosting service. + +# [Azure Cache for Redis](#tab/azure-redis) + +Add the [Aspire.Hosting.Azure.Redis](https://www.nuget.org/packages/Aspire.Hosting.Azure.Redis) package to the _AspireRedis.AppHost_ project: + +```dotnetcli +dotnet add package Aspire.Hosting.Azure.Redis --prerelease +``` + +## [Redis Container](#tab/redis-container) + +Add the [Aspire.Hosting.Redis](https://www.nuget.org/packages/Aspire.Hosting.Redis) package to the _AspireRedis.AppHost_ project: + +```dotnetcli +dotnet add package Aspire.Hosting.Redis --prerelease +``` + +--- + +### Configure the AppHost project + +Configure the _AspireRedis.AppHost_ project for your desired Redis service. + +# [Azure Cache for Redis](#tab/azure-redis) + +Replace the contents of the _Program.cs_ file in the _AspireRedis.AppHost_ project with the following code: + +```csharp +var builder = DistributedApplication.CreateBuilder(args); + +var cache = builder.AddRedis("cache") + .PublishAsAzureRedis(); + +var apiService = builder.AddProject("apiservice") + .WithReference(cache); + +builder.AddProject("webfrontend") + .WithExternalHttpEndpoints() + .WithReference(cache) + .WithReference(apiService); + +builder.Build().Run(); +``` + +The preceding code adds an Azure Cache for Redis resource to your app and configures a connection called `cache`. The `PublishAsAzureRedis` method ensures that tools such as the Azure Developer CLI or Visual Studio create an Azure Cache for Redis resource during the deployment process. + +## [Redis Container](#tab/redis-container) + +Replace the contents of the _Program.cs_ file in the _AspireRedis.AppHost_ project with the following code: + +```csharp +var builder = DistributedApplication.CreateBuilder(args); + +var cache = builder.AddRedis("cache"); + +var apiService = builder.AddProject("apiservice") + .WithReference(cache); + +builder.AddProject("webfrontend") + .WithExternalHttpEndpoints() + .WithReference(cache) + .WithReference(apiService); + +builder.Build().Run(); +``` + +The preceding code adds a Redis Container resource to your app and configures a connection called `cache`. This configuration also ensures that tools such as the Azure Developer CLI or Visual Studio create a containerized Redis instance during the deployment process. + +--- + +## Deploy the app + +Tools such as the [Azure Developer CLI](/azure/developer/azure-developer-cli/overview) (`azd`) support .NET Aspire Redis component configurations to streamline deployments. `azd` consumes these settings and provisions properly configured resources for you. + +> [!NOTE] +> You can also use the [Azure CLI](/dotnet/aspire/deployment/azure/aca-deployment?pivots=azure-cli) or [Bicep](/dotnet/aspire/deployment/azure/aca-deployment?pivots=azure-bicep) to provision and deploy .NET Aspire app resources. These options require more manual steps, but provide more granular control over your deployments. .NET Aspire apps can also connect to an existing Redis instance through manual configurations. + +1. Open a terminal window in the root of your .NET Aspire project. + +1. Run the `azd init` command to initialize the project with `azd`. + + ```azdeveloper + azd init + ``` + +1. When prompted for an environment name, enter *docs-aspireredis*. + +1. Run the `azd up` command to begin the deployment process: + + ```azdeveloper + azd up + ``` + +1. Select the Azure subscription that should host your app resources. + +1. Select the Azure location to use. + + The Azure Developer CLI provisions and deploys your app resources. The process may take a few minutes to complete. + +1. When the deployment finishes, click the resource group link in the output to view the created resources in the Azure portal. + +## [Azure Cache for Redis](#tab/azure-redis) + +The deployment process provisioned an Azure Cache for Redis resource due to the **.AppHost** configuration you provided. + +:::image type="content" source="media/resources-azure-redis.png" alt-text="A screenshot showing the deployed Azure Cache for Redis."::: + +## [Redis Container](#tab/redis-container) + +The deployment process created a Redis app container due to the **.AppHost** configuration you provided. + +:::image type="content" source="media/resources-azure-redis-container.png" alt-text="A screenshot showing the containerized Redis."::: + +--- + +[!INCLUDE [clean-up-resources](../includes/clean-up-resources.md)] + +## See also + +- [.NET Aspire deployment via Azure Container Apps](../deployment/azure/aca-deployment.md) +- [.NET Aspire Azure Container Apps deployment deep dive](../deployment/azure/aca-deployment-azd-in-depth.md) +- [Deploy a .NET Aspire app using GitHub Actions](../deployment/azure/aca-deployment-github-actions.md) diff --git a/docs/caching/media/resources-azure-redis-container.png b/docs/caching/media/resources-azure-redis-container.png new file mode 100644 index 0000000000..95ac1959fb Binary files /dev/null and b/docs/caching/media/resources-azure-redis-container.png differ diff --git a/docs/caching/media/resources-azure-redis.png b/docs/caching/media/resources-azure-redis.png new file mode 100644 index 0000000000..a823d68551 Binary files /dev/null and b/docs/caching/media/resources-azure-redis.png differ diff --git a/docs/fundamentals/components-overview.md b/docs/fundamentals/components-overview.md index b9239e1559..a2a55de77f 100644 --- a/docs/fundamentals/components-overview.md +++ b/docs/fundamentals/components-overview.md @@ -1,7 +1,7 @@ --- title: .NET Aspire components overview description: Explore the fundamental concepts of .NET Aspire components and learn how to integrate them into your apps. -ms.date: 12/20/2023 +ms.date: 05/09/2024 ms.topic: conceptual --- @@ -42,7 +42,7 @@ For more information on working with .NET Aspire components in Visual Studio, se ## Explore a sample component workflow -.NET Aspire components streamline the process of consuming popular services and platforms. For example, consider the **.NET Aspire Application** template. With this template, you get the [AppHost](app-host-overview.md) and [ServiceDefaults](service-defaults.md) projects. Imagine that you have a need for a worker service to perform some database processing. You could use the [.NET Aspire PostgreSQL component](../database/postgresql-component.md) to connect to and utilize a PostgreSQL database. The database could be hosted on-prem or in a cloud service such as Azure, AWS, or GCP. The following steps demonstrate how to integrate this component into your app: +.NET Aspire components streamline the process of consuming popular services and platforms. For example, consider the **.NET Aspire Application** template. With this template, you get the [AppHost](app-host-overview.md) and [ServiceDefaults](service-defaults.md) projects. Imagine that you have a need for a worker service to perform some database processing. You could use the [.NET Aspire PostgreSQL component](../database/postgresql-component.md) to connect to and utilize a PostgreSQL database. The database could be hosted on-prem or in a cloud service such as Azure, AWS, or GCP. The following steps demonstrate how to integrate this component into your app: 1. In the component consuming (worker service) project, install the [Aspire.Npgsql](https://www.nuget.org/packages/Aspire.Npgsql) NuGet package. @@ -73,7 +73,7 @@ For more information on working with .NET Aspire components in Visual Studio, se 1. In your app host project (the project with the _*.AppHost_ suffix), add a reference to the worker service project. If you're using Visual Studio, you can use the [**Add .NET Aspire Orchestrator Support**](setup-tooling.md#add-orchestration-projects) project context menu item to add the reference automatically. The following code snippet shows the project reference of the _AspireApp.AppHost.csproj_: - :::code language="xml" source="snippets/components/AspireApp/AspireApp.AppHost/AspireApp.AppHost.csproj" highlight="16"::: + :::code language="xml" source="snippets/components/AspireApp/AspireApp.AppHost/AspireApp.AppHost.csproj" highlight="17"::: After the worker service is referenced by the orchestrator project, the worker service project has its _Program.cs_ file updated to call the `AddServiceDefaults` method. For more information on service defaults, see [Service defaults](service-defaults.md). diff --git a/docs/fundamentals/dashboard/standalone.md b/docs/fundamentals/dashboard/standalone.md index 907fa53154..b714128c91 100644 --- a/docs/fundamentals/dashboard/standalone.md +++ b/docs/fundamentals/dashboard/standalone.md @@ -1,7 +1,7 @@ --- title: Standalone .NET Aspire dashboard description: How to use the .NET Aspire dashboard standalone. -ms.date: 04/30/2024 +ms.date: 05/09/2024 ms.topic: reference --- @@ -9,7 +9,7 @@ ms.topic: reference The [.NET Aspire dashboard](overview.md) provides a great UI for viewing telemetry. The dashboard: -- Ships as a Docker image that can be used with any OpenTelemetry enabled app. +- Ships as a container image that can be used with any OpenTelemetry enabled app. - Can be used standalone, without the rest of .NET Aspire. :::image type="content" source="media/explore/trace.png" lightbox="media/explore/trace.png" alt-text="A screenshot of the .NET Aspire dashboard Trace details page."::: @@ -20,12 +20,12 @@ The dashboard is started using the Docker command line. ```bash docker run --rm -it -p 18888:18888 -p 4317:18889 -d --name aspire-dashboard \ - mcr.microsoft.com/dotnet/nightly/aspire-dashboard:8.0.0-preview.6 + mcr.microsoft.com/dotnet/nightly/aspire-dashboard:8.0.0-preview.7 ``` The preceding Docker command: -- Starts a container from the `mcr.microsoft.com/dotnet/nightly/aspire-dashboard:8.0.0-preview.6` image. +- Starts a container from the `mcr.microsoft.com/dotnet/nightly/aspire-dashboard:8.0.0-preview.7` image. - The container has two ports: - Port `4317` receives OpenTelemetry data from apps. Apps send data using [OpenTelemetry Protocol (OTLP)](https://opentelemetry.io/docs/specs/otlp/). - Port `18888` has the dashboard UI. Navigate to `http://localhost:18888` in the browser to view the dashboard. @@ -48,7 +48,7 @@ The dashboard offers a UI for viewing telemetry. Refer to the documentation to e - [Traces page](explore.md#traces-page) - [Metrics page](explore.md#metrics-page) -Although there is no restriction on where the dashboard is run, the dashboard is designed as a development and short-term diagnosic tool. The dashboard persists telemetry in-memory which creates some limitations: +Although there is no restriction on where the dashboard is run, the dashboard is designed as a development and short-term diagnostic tool. The dashboard persists telemetry in-memory which creates some limitations: - Telemetry is automatically removed if [telemetry limits](configuration.md#telemetry-limits) are exceeded. - No telemetry is persisted when the dashboard is restarted. @@ -67,7 +67,7 @@ Apps collect and send telemetry using [their language's OpenTelemetry SDK](https Important OpenTelemetry SDK options to configure: -- OTLP endpoint, which should match the dashboard's configuration, e.g., `http://localhost:4317`. +- OTLP endpoint, which should match the dashboard's configuration, for example, `http://localhost:4317`. - OTLP protocol, with the dashboard currently supporting only the [OTLP/gRPC protocol](https://opentelemetry.io/docs/specs/otlp/#otlpgrpc). Configure applications to use the `grpc` protocol. To configure applications: diff --git a/docs/get-started/build-your-first-aspire-app.md b/docs/get-started/build-your-first-aspire-app.md index c26ac7e46b..ec7e591d93 100644 --- a/docs/get-started/build-your-first-aspire-app.md +++ b/docs/get-started/build-your-first-aspire-app.md @@ -1,7 +1,7 @@ --- title: Build your first .NET Aspire app description: Learn how to build your first .NET Aspire app using the .NET Aspire Started Application template. -ms.date: 12/07/2023 +ms.date: 05/13/2024 ms.topic: quickstart --- @@ -119,7 +119,7 @@ Finally, the app is built and run. The type, named `AddServiceDefaults`. The service defaults project from the template is a starting point, and you can customize it to meet your needs. For more information, see [.NET Aspire service defaults](../fundamentals/service-defaults.md). @@ -133,13 +133,13 @@ The front end app defines a typed that's used The `HttpClient` is configured to use service discovery, consider the following code from the _Program.cs_ file of the _AspireSample.Web_ project: -:::code source="snippets/quickstart/AspireSample/AspireSample.Web/Program.cs" highlight="7-8,14-15"::: +:::code source="snippets/quickstart/AspireSample/AspireSample.Web/Program.cs" highlight="7-8,14-19"::: The preceding code: - Calls `AddServiceDefaults`, configuring the shared defaults for the app. - Calls with the same `connectionName` that was used when adding the Redis container `"cache"` to the application model. This configures the app to use Redis for output caching. -- Calls and configures the to be `"http://apiservice"`. This is the name that was used when adding the API project to the application model, and with service discovery configured, it will automatically resolve to the correct address to the API project. +- Calls and configures the to be `"https+http://apiservice"`. This is the name that was used when adding the API project to the application model, and with service discovery configured, it will automatically resolve to the correct address to the API project. For more information, see [Make HTTP requests with the `HttpClient`](/dotnet/fundamentals/networking/http/httpclient) class. @@ -147,6 +147,7 @@ For more information, see [Make HTTP requests with the `HttpClient`](/dotnet/fun - [.NET Aspire components overview](../fundamentals/components-overview.md) - [Service discovery in .NET Aspire](../service-discovery/overview.md) +- [Service discovery in .NET](/dotnet/core/extensions/service-discovery) - [.NET Aspire service defaults](../fundamentals/service-defaults.md) - [Health checks in .NET Aspire](../fundamentals/health-checks.md) - [.NET Aspire telemetry](../fundamentals/telemetry.md) diff --git a/docs/get-started/media/aspire-dashboard-trace.png b/docs/get-started/media/aspire-dashboard-trace.png index 378ddc971d..bc17280bde 100644 Binary files a/docs/get-started/media/aspire-dashboard-trace.png and b/docs/get-started/media/aspire-dashboard-trace.png differ diff --git a/docs/get-started/media/aspire-dashboard-webfrontend.png b/docs/get-started/media/aspire-dashboard-webfrontend.png index 02fe2d3848..1a9cb09992 100644 Binary files a/docs/get-started/media/aspire-dashboard-webfrontend.png and b/docs/get-started/media/aspire-dashboard-webfrontend.png differ diff --git a/docs/get-started/media/aspire-dashboard.png b/docs/get-started/media/aspire-dashboard.png index 49f2416c15..4cefc9fc1b 100644 Binary files a/docs/get-started/media/aspire-dashboard.png and b/docs/get-started/media/aspire-dashboard.png differ diff --git a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ApiService/AspireSample.ApiService.csproj b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ApiService/AspireSample.ApiService.csproj index 74c9840473..884b602434 100644 --- a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ApiService/AspireSample.ApiService.csproj +++ b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ApiService/AspireSample.ApiService.csproj @@ -1,7 +1,6 @@ - Exe net8.0 enable enable diff --git a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ApiService/Program.cs b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ApiService/Program.cs index 868de0085c..a93ae74197 100644 --- a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ApiService/Program.cs +++ b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ApiService/Program.cs @@ -1,4 +1,4 @@ -var builder = WebApplication.CreateBuilder(args); +var builder = WebApplication.CreateBuilder(args); // Add service defaults & Aspire components. builder.AddServiceDefaults(); @@ -18,7 +18,7 @@ app.MapGet("/weatherforecast", () => { - var forecast = Enumerable.Range(1, 5).Select(index => + var forecast = Enumerable.Range(1, 5).Select(index => new WeatherForecast ( DateOnly.FromDateTime(DateTime.Now.AddDays(index)), diff --git a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ApiService/Properties/launchSettings.json b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ApiService/Properties/launchSettings.json index 1f9864ddf7..44dc06a6b7 100644 --- a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ApiService/Properties/launchSettings.json +++ b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ApiService/Properties/launchSettings.json @@ -1,12 +1,12 @@ { - "$schema": "http://json.schemastore.org/launchsettings.json", + "$schema": "https://json.schemastore.org/launchsettings.json", "profiles": { "http": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "weatherforecast", - "applicationUrl": "http://localhost:5499", + "applicationUrl": "http://localhost:5593", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -16,7 +16,7 @@ "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "weatherforecast", - "applicationUrl": "https://localhost:7453;http://localhost:5499", + "applicationUrl": "https://localhost:7352;http://localhost:5593", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/AspireSample.AppHost.csproj b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/AspireSample.AppHost.csproj index e793219d75..096dbcf111 100644 --- a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/AspireSample.AppHost.csproj +++ b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/AspireSample.AppHost.csproj @@ -1,4 +1,4 @@ - + Exe @@ -6,6 +6,7 @@ enable enable true + 1b1a6997-c2dd-47d0-b3fa-46811f182483 diff --git a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/Program.cs b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/Program.cs index 6497f8040d..7da85487da 100644 --- a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/Program.cs +++ b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/Program.cs @@ -2,10 +2,11 @@ var cache = builder.AddRedis("cache"); -var apiservice = builder.AddProject("apiservice"); +var apiService = builder.AddProject("apiservice"); builder.AddProject("webfrontend") + .WithExternalHttpEndpoints() .WithReference(cache) - .WithReference(apiservice); + .WithReference(apiService); builder.Build().Run(); diff --git a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/Properties/launchSettings.json b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/Properties/launchSettings.json index 233be48cb0..97b97e7a45 100644 --- a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/Properties/launchSettings.json +++ b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/Properties/launchSettings.json @@ -1,26 +1,28 @@ { - "$schema": "http://json.schemastore.org/launchsettings.json", + "$schema": "https://json.schemastore.org/launchsettings.json", "profiles": { - "http": { + "https": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "http://localhost:15031", + "applicationUrl": "https://localhost:17187;http://localhost:15293", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "DOTNET_ENVIRONMENT": "Development", - "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16048" + "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21171", + "DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22170" } }, - "https": { + "http": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "applicationUrl": "https://localhost:17099;http://localhost:15031", + "applicationUrl": "http://localhost:15293", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "DOTNET_ENVIRONMENT": "Development", - "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:18068" + "DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19179", + "DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20127" } } } diff --git a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/appsettings.json b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/appsettings.json index 0c208ae918..31c092aa45 100644 --- a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/appsettings.json +++ b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.AppHost/appsettings.json @@ -2,7 +2,8 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft.AspNetCore": "Warning" + "Microsoft.AspNetCore": "Warning", + "Aspire.Hosting.Dcp": "Warning" } } } diff --git a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ServiceDefaults/AspireSample.ServiceDefaults.csproj b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ServiceDefaults/AspireSample.ServiceDefaults.csproj index 85621e6959..f48299bb58 100644 --- a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ServiceDefaults/AspireSample.ServiceDefaults.csproj +++ b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ServiceDefaults/AspireSample.ServiceDefaults.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -10,7 +10,7 @@ - + diff --git a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ServiceDefaults/Extensions.cs b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ServiceDefaults/Extensions.cs index f00dc4ecea..877f870b74 100644 --- a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ServiceDefaults/Extensions.cs +++ b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.ServiceDefaults/Extensions.cs @@ -1,9 +1,9 @@ -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Logging; -using OpenTelemetry.Logs; +using OpenTelemetry; using OpenTelemetry.Metrics; using OpenTelemetry.Trace; @@ -28,12 +28,6 @@ public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBu http.AddServiceDiscovery(); }); - // Uncomment the following to restrict the allowed schemes for service discovery. - // builder.Services.Configure(options => - // { - // options.AllowedSchemes = ["https"]; - // }); - return builder; } @@ -54,12 +48,6 @@ public static IHostApplicationBuilder ConfigureOpenTelemetry(this IHostApplicati }) .WithTracing(tracing => { - if (builder.Environment.IsDevelopment()) - { - // We want to view all traces in development - tracing.SetSampler(new AlwaysOnSampler()); - } - tracing.AddAspNetCoreInstrumentation() // Uncomment the following line to enable gRPC instrumentation (requires the OpenTelemetry.Instrumentation.GrpcNetClient package) //.AddGrpcClientInstrumentation() @@ -77,9 +65,7 @@ private static IHostApplicationBuilder AddOpenTelemetryExporters(this IHostAppli if (useOtlpExporter) { - builder.Services.Configure(logging => logging.AddOtlpExporter()); - builder.Services.ConfigureOpenTelemetryMeterProvider(metrics => metrics.AddOtlpExporter()); - builder.Services.ConfigureOpenTelemetryTracerProvider(tracing => tracing.AddOtlpExporter()); + builder.Services.AddOpenTelemetry().UseOtlpExporter(); } // Uncomment the following lines to enable the Prometheus exporter (requires the OpenTelemetry.Exporter.Prometheus.AspNetCore package) diff --git a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.Web/AspireSample.Web.csproj b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.Web/AspireSample.Web.csproj index 1480df4224..639d965d7b 100644 --- a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.Web/AspireSample.Web.csproj +++ b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.Web/AspireSample.Web.csproj @@ -1,7 +1,6 @@ - Exe net8.0 enable enable @@ -14,5 +13,5 @@ - + diff --git a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.Web/Components/Layout/MainLayout.razor b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.Web/Components/Layout/MainLayout.razor index c8f5e8fbcf..5a24bb1371 100644 --- a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.Web/Components/Layout/MainLayout.razor +++ b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.Web/Components/Layout/MainLayout.razor @@ -7,7 +7,7 @@
- About + About
diff --git a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.Web/Components/Layout/NavMenu.razor b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.Web/Components/Layout/NavMenu.razor index 12e6f848ab..97ece53c34 100644 --- a/docs/get-started/snippets/quickstart/AspireSample/AspireSample.Web/Components/Layout/NavMenu.razor +++ b/docs/get-started/snippets/quickstart/AspireSample/AspireSample.Web/Components/Layout/NavMenu.razor @@ -13,7 +13,7 @@ Home - +