diff --git a/docs/index.yml b/docs/index.yml index 423665e0a..1121bf09a 100644 --- a/docs/index.yml +++ b/docs/index.yml @@ -211,6 +211,12 @@ conceptualContent: - itemType: how-to-guide text: The specified name is already in use url: troubleshooting/name-is-already-in-use.md + - itemType: how-to-guide + text: Container runtime appears to be unhealthy + url: troubleshooting/container-runtime-unhealthy.md + - itemType: how-to-guide + text: The connection string is missing + url: troubleshooting/connection-string-missing.md - itemType: reference text: Ask questions on Discord url: https://aka.ms/aspire/discord diff --git a/docs/toc.yml b/docs/toc.yml index 12bfb42fe..3edde5f83 100644 --- a/docs/toc.yml +++ b/docs/toc.yml @@ -240,6 +240,10 @@ items: href: troubleshooting/unable-to-install-workload.md - name: The specified name is already in use href: troubleshooting/name-is-already-in-use.md + - name: Container runtime appears to be unhealthy + href: troubleshooting/container-runtime-unhealthy.md + - name: The connection string is missing + href: troubleshooting/connection-string-missing.md - name: .NET Aspire GitHub repository href: https://github.com/dotnet/aspire - name: Ask questions on Discord diff --git a/docs/troubleshooting/connection-string-missing.md b/docs/troubleshooting/connection-string-missing.md new file mode 100644 index 000000000..f8fa13819 --- /dev/null +++ b/docs/troubleshooting/connection-string-missing.md @@ -0,0 +1,35 @@ +--- +title: The connection string is missing +description: Learn how to troubleshoot the error "ConnectionString is missing" during execution of your app. +ms.date: 07/03/2024 +--- + +# Connection string is missing + +In .NET Aspire, code identifies resources with an arbitrary string, such as "database". Code that is consuming the resource elsewhere must use the same string or it will fail to correctly configure their relationships. + +## Symptoms + +When your app accesses a service that needs one of the components in your app, it may fail with an exception similar to the following: + +> "InvalidOperationException: ConnectionString is missing." + +## Possible solutions + +Verify that the name of the resource, for instance a database resource, is the same in the AppHost and the Service that fails. + +For example, if the AppHost defines a PostgreSQL resource with the name `db1` like this: + +```csharp +var db1 = builder.AddPostgres("pg1").AddDatabase("db1"); +``` + +Then the service needs to resolve the resource with the same name `db1`. + +```csharp +var builder = WebApplication.CreateBuilder(args); + +builder.AddNpgsqlDbContext("db1"); +``` + +Any other value than the one provided in the AppHost will result in the exception message described above. diff --git a/docs/troubleshooting/container-runtime-unhealthy.md b/docs/troubleshooting/container-runtime-unhealthy.md new file mode 100644 index 000000000..731bd4f80 --- /dev/null +++ b/docs/troubleshooting/container-runtime-unhealthy.md @@ -0,0 +1,32 @@ +--- +title: Container runtime appears to be unhealthy +description: Learn how to troubleshoot the error "Container runtime 'docker' was found but appears to be unhealthy" during execution of your app. +ms.date: 07/03/2024 +--- + +# Container runtime appears to be unhealthy + +.NET Aspire requires Docker (or Podman) to be running and healthy. This topic describes a possible symptom you may see if Docker isn’t in a healthy state. + +## Symptoms + +When starting the AppHost the dashboard doesn't show up and an exception stack trace similar to this example is displayed in the console: + +```Output +info: Aspire.Hosting.DistributedApplication[0] + Aspire version: 8.1.0-dev +info: Aspire.Hosting.DistributedApplication[0] + Distributed application starting. +info: Aspire.Hosting.DistributedApplication[0] + Application host directory is: D:\aspire\playground\PostgresEndToEnd\PostgresEndToEnd.AppHost +fail: Microsoft.Extensions.Hosting.Internal.Host[11] + Hosting failed to start + Aspire.Hosting.DistributedApplicationException: Container runtime 'docker' was found but appears to be unhealthy. The error from the container runtime check was error during connect: this error may indicate that the docker daemon is not running: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.45/containers/json?limit=1": open //./pipe/docker_engine: The system cannot find the file specified.. +``` + +## Possible solutions + +Confirm that Docker is installed and running: + +- On Windows, check that in the system tray the Docker icon is present and marked as "Running". +- On Linux, check that `docker ps -a` returns success.