-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfaceab
commit 5417081
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |