Training
Module
Introduction to .NET Aspire - Training
In this module, you learn about cloud-native applications and how the .NET Aspire stack makes it easier to develop microservices and connect them with each other and with supporting services.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Includes:
Hosting integration not
Client integration
Note
This integration is part of the .NET Aspire Community Toolkit and isn't officially supported by the .NET Aspire team.
Rust is a general-purpose programming language emphasizing performance, type safety, and concurrency. It enforces memory safety, meaning that all references point to valid memory. The .NET Aspire Rust hosting integration allows you to host Rust applications in your .NET Aspire app host project, and provide it to other resources in your application.
The Rust hosting integration models a Rust application as the Aspire.Hosting.ApplicationModel.RustAppExecutableResource
type. To access this type and APIs that allow you to add it to your app host project, install the 📦 CommunityToolkit.Aspire.Hosting.Rust NuGet package in the app host project.
This integration expects that the Rust programming language has already been installed on the host machine and the Rust package manager cargo
is available in the system path.
dotnet add package CommunityToolkit.Aspire.Hosting.Rust
For more information, see dotnet add package or Manage package dependencies in .NET applications.
In the Program.cs file of your app host project, call the Aspire.Hosting.RustAppHostingExtension.AddRustApp
on the builder
instance to add a Rust application resource as shown in the following example:
var builder = DistributedApplication.CreateBuilder(args);
var rust = builder.AddRustApp("rust-app", workingDirectory: "../rust-service")
.WithHttpEndpoint(env: "PORT");
var exampleProject = builder.AddProject<Projects.ExampleProject>()
.WithReference(rust);
// After adding all resources, run the app...
The working directory of the application should be the root of Rust application directory.
Also you can customize running behavior by passing args parameter to the AddRustApp
method.
var rust = builder.AddRustApp("rust-app", workingDirectory: "../rust-service", args: ["--locked"])
.WithHttpEndpoint(env: "PORT");
The Rust application can be added as a reference to other resources in the app host project.
.NET Aspire feedback
.NET Aspire is an open source project. Select a link to provide feedback:
Training
Module
Introduction to .NET Aspire - Training
In this module, you learn about cloud-native applications and how the .NET Aspire stack makes it easier to develop microservices and connect them with each other and with supporting services.