Skip to content

Commit

Permalink
Add two troubleshooters (#1249)
Browse files Browse the repository at this point in the history
  • Loading branch information
danmoseley authored Jul 5, 2024
1 parent cfaceab commit 5417081
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions docs/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 35 additions & 0 deletions docs/troubleshooting/connection-string-missing.md
Original file line number Diff line number Diff line change
@@ -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<MyDb1Context>("db1");
```

Any other value than the one provided in the AppHost will result in the exception message described above.
32 changes: 32 additions & 0 deletions docs/troubleshooting/container-runtime-unhealthy.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 5417081

Please sign in to comment.