1 Getting started with distributed systems and Aspire
This chapter covers
- Why distributed applications are difficult to run and debug locally
- How Aspire models application services and infrastructure resources
- How AppHost and service defaults configure an Aspire application
- How service discovery connects services without hardcoded addresses
Running one application is easy. Running an application made up of several independently executing parts is rather more difficult.
Consider an online shopping system. Such a system couldn’t function if it were just a simple website. It has many moving parts: its storefront needs a catalog API; the catalog API will eventually need a database and a distributed cache; checkout will publish messages to a broker; background services will process orders; and every component will produce logs, traces, and metrics.
In production, these parts work together as one system. A system structured this way is known as a distributed application.
On a development machine, though, separate components often have to be started individually. Each resource needs the correct configuration. Services need to know where their dependencies are running. Containers need ports and volumes. One service may start before another is ready. When something fails, its logs may be hidden in one of several terminal windows.