dotnet / docs-aspire

This repository contains .NET Aspire documentation.
https://learn.microsoft.com/dotnet/aspire
MIT License
80 stars 105 forks source link

[New article]: WaitFor/WaitForCompletion docs #1556

Closed mitchdenny closed 3 days ago

mitchdenny commented 2 months ago

Proposed topic or title

Controlling service startup

Location in table of contents.

No response

Reason for the article

We are introducing WaitFor and WaitForCompletion APIs in .NET Aspire 9.0 which will allow resource startup to be controlled for local development. This will also integrate with a health check mechanism for resources which runs within the app host.

Article abstract

The article would take a simple application that uses a database and has two services (front-end and backend) and talk through what could happen when starting all these projects locally. Issues like the database not be initialized (writing a console app to initialize the database and using the WaitForCompletion API) and waiting for dependent services to start.

Relevant searches

No response


Associated WorkItem - 308088

afscrome commented 2 months ago

Not sure if it should go into this article, or be a separate related article but it would be helpful to document some of the errors that you get if you don't use WatiFor. e.g. if you try to connect to SQL before it's ready, you'll get the following error

Microsoft.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - 20)

The idea would be that if someone gets this error (or similar errors for other components) and puts it into a search engine, there should be a good chance that the WaitFor docs appear with how to solve the issue.

afscrome commented 1 month ago

Another thing to watch out for when documenting this - docs already have sections for client integrations health checks - e.g. https://learn.microsoft.com/en-us/dotnet/aspire/database/sql-server-integration?tabs=dotnet-cli#health-checks

Need to be make sure to clearly distinguish between the app host health checks and the client health checks.

davidfowl commented 1 month ago

We’re revamping integration docs. They haven’t been updated yet.

We’re currently starting with rabbitmq

https://github.com/dotnet/docs-aspire/pull/1759