Jon Rumsey

An online markdown blog and knowledge repository.


Project maintained by nojronatron Hosted on GitHub Pages — Theme by mattgraham

DotNET Aspire Learnings

Notes from my learnings about this MSFT Framework for .NET 8 and newer.

Table of Contents

DotNET Aspire Developers Day

This full-day event will overview .NET Aspire and dive in to use cases and implementation details from 0900 to 1600 PDT on 23-July-2024.

Keynote

Presenters:

Your building blocks for cloud development.

App needs, Aspire Delivers:

Basic Cloud Services today at minimal require:

Anything more than basic cloud services contain many frameworks and services and are usually very complex.

Aspire Stack Features:

Aspire Use Pitch:

Aspire supports other language projects too!

Add Aspire To An App:

  1. Have an existing app.
  2. Add an Aspire AppHost project.
  3. The Aspire Project creates an interface that provides logging, tracing, and various other features to help manage the existing app project(s).

Obviously, there's a bit more to it, but the above is the general idea.

Announcement: .NET Aspire 8.1 officially released 23-July-2024

Enhance Business Processes with .NET Aspire and Generative AI

Presenter:

What about experiences other than Chat Bots?

What are my users really going to use? How can I develop measureable features in this solution?

JavaScript/Node with .NET Aspire

Presenter:

Problems Aspire Attempts To Fix:

Key Aspire Features and Components:

Aspire Use Cases:

More About Orchestration:

Core Concepts:

Prerequisites:

Scaffold The Project:

Starter Template:

Important AppHost Project Components using the Aspire Manifest:

Projects are added to Aspire in the DI using AddProject<T> and defining a default string name.

.NET Aspire with MongoDB

Presenter:

MongoDB, ConsmosDB

MongoDB with .NET Aspire

Database and .NET Aspire "DAB"

Speaker:

Demo:

Taking Advantage of .NET Aspire to Build Event-Driven Apps Using CQRS

Speaker:

I took a break during this presentation. Notes will be added later if/when the presentation is available for future review.

Components

Speaker:

I took a break during this presentation. Notes will be added later if/when the presentation is available for future review.

Secrets, Security, and Key Cloak

Speaker:

Authentication:

Authorization:

Secrets:

KeyCloak:

Hierarchy of Secret:

Secret Parameters:

Deployment Options for .NET Aspire Apps

Speakers:

Flexible Integrations and Deployment:

  1. Create and update your Aspire-based app.
  2. Right-click Publish, which leverages AZD under the hood.

Compare this to doing your build and deploy operations project-by-project, especially for larger, production deployments.

CI-CD Aspire with AZD Demo:

Aspir8

.NET Aspire Dashboard and Telemetry

Speaker:

Focus on Telemetry, using the Dashboard to gain insights into your App.

Note: There is a standalone dashboard experience available from .NET Aspire!

Dashboard Exploration:

Create Your Own Metrics!

Production Grade Observability with Azure Monitor Application Insights

Speaker:

I took a break during this presentation. Notes will be added later if/when the presentation is available for future review.

OpenTelemetry with New Relic

Speaker:

Modern observability business objectives:

New Relic:

.NET Aspire Internals and Extensibility

Presenter:

Note: Aspire Test Projects can be added individually to an existing Solution.

The Layers of .NET Aspire:

Extensions:

.NET Aspire Primitives (key concepts):

Distributed Application Lifecycle Rules?

Reducing Bugs with Raygun, .NET Aspire, and Local AI

Presenter:

John-Daniel Demoed adding RayGun to a .NET App with .NET Aspire:

Hands-on with MS Learn

Notes taken while following MS Learn DotNet Aspire steps using VS Code as the IDE.

Docker Desktop

There is a prerequisite of installing Docker (Docker Desktop) to manage images for local and cloud deployment.

Create New DotNet Aspire Application with VS Code

In the terminal, execute: dotnet new aspire-starter -o target_directory.

Using VS Code: Open the Command Palette and select ".NET Aspire Starter Application".

Testing The Application Locally

It might be necessary to configure dotnet to trust the developer certificates by using dotnet dev-certs https --trust.

Note: I have not had to do this before, nor did I have to do it this time. It could be that since I've responded "Yes, trust this certificate" in the past within the browser view, this step is no longer required on my workstation profile.

To launch from the terminal: dotnet run --project .\project_path\project_file.csproj and view the Terminal output to get the URL and port(s) to plug-in to the browser.

The Aspire Resources page will have links to the Endpoints that can be clicked to launch a browser to view the endpoint WebApp.

DotNet Aspire Starter Template Project Hierarchy

Project Definition - Aspire Host Project:

Project Definition - Service Defaults Project:

File Extensions.cs exposes methods that enable additional behaviors and capabilities:

Add Aspire Orchestration to an Existing Project

Note: The following instructions are using the Cli. Using Visual Studio is much simpler and information is included below.

Using Cli Commands and DotNet

Add an App Host Project using DotNET Cli:

  1. Add an Aspire AppHost project: dotnet new aspire-apphost -o project_name
  2. Add the AppHost Project reference to the Solution file: dotnet sln solution_file add path_to_project_file
  3. Add Project references to AppHost that point to other Projects it needs to know about: dotnet add apphost_project_file reference other_project_file

Add a Service Defaults Project:

  1. dotnet new aspire-servicedefaults -o eShopLite.ServiceDefaults
  2. Add the Service Defaults Project reference to the solution file: dotnet sln solution_file add path_to_project_file
  3. Add Project reference to AppHost that points to the Service Defaults Project: dotnet add apphost_project_file reference other_project_file
  4. Add Project references in other Projects that reference the Service Defaults project (enabling service discovery) (use dotnet cli commands for this, too).
  5. Open Program.cs in each of the original Projects and add the line builder.AddServiceDefaults() immediately following var builder = ... line.

Update App Host Project:

Add the following lines to the AppHost project's Program.cs file after var builder = ...: builder.AddProject<Projects.proj_name>("friendly-name");, one for each Project to be added to the orchestrator.

Enable Service Discovery To Existing Projects:

  1. Use function chaining following builder.AddProject<T>() to add services to Service Discovery.
  2. To Add http endpoints for deployment to a Cloud or Hosted environment: .WithExternalHttpEndpoints() (skipping this step will render the app inaccessible to external http clients).
  3. To Add a reference to a dependency Project use .WithReference(friendly_name)
  4. Update appsettings.json of the primary Project (application) to change the URLs to use the friendly-name of the endpoints host (instead of localhost). This ensures Aspire can find the endpoints and also ensures the endpoint IDs are discoverable.

Using Visual Studio

Using Visual Studio to add .NET Aspire components and reference to an existing Solution is much simpler than doing so by the CLI.

Adding Orchestration Support:

Adding Service Discovery:

About Dotnet Cli Versus Visual Studio

DotNET Aspire Tooling

Assist in creating and configuring cloud-native applications.

Aspire Limitations and Gotchas

As of 27-Sept-2024

Resources

Return to Conted Index

Return to Root README