-->
.NET Aspire is still in preview at the time of writing but it is an opinionated stack for building distributed applications. We can use it to develop and test cloud native distributed applications locally and then deploy them to the cloud.
With a web app that connects to one database the set up is relatively simple but when we depend on services that all have their own dependencies then setting these up locally can become quite complex and time consuming.
.NET Aspire can help to solve this issue by describing the dependencies in the AppHost project. We can then run the AppHost project, which will coordinate the configuration and running of these dependencies. When we want to push things to the cloud we find this can be done quickly too. The Azure Developer CLI “knows” about Aspire projects and can provision all the resources in Azure and then deploy your application in just a single command “azd up” https://learn.microsoft.com/en-us/dotnet/aspire/deployment/azure/aca-deployment-azd-in-depth
There are other tools that can do a similar function, such as docker-compose or skaffold. If you choose one of these, you quickly find that you have solved one problem but have discovered a number of other things that you now need to address, which can become overwhelming. In contrast, by choosing .NET Aspire someone has made all the choices for you and because it is Microsoft they are likely to be good ones. Also look at the awesome local dashboard and log interface straight out of the box.
I have not included any sample code as the project’s get started guide is so good that it would have been a copy paste of that. The get started guide is here https://learn.microsoft.com/en-us/dotnet/aspire/get-started/build-your-first-aspire-app?tabs=dotnet-cli
One thing I found when I deployed to Azure Container Apps (ACA) was that the front end ingress is private and so I needed to configure the ingress manually in azure to make it public. It looks like this can currently only be fixed by generating and tweaking the bicep files https://github.com/dotnet/aspire/discussions/2265
I’m used to seeing app insights for my apps running in Azure but when i deployed to ACA it wasn’t there. Fortunately support can be added very simply by following the steps here https://learn.microsoft.com/en-us/dotnet/aspire/deployment/azure/application-insights