microsoft / microsoft/aspire

Aspire Run fails silently if a container uses parameter-less .WithHttpEndpoint()

Open
#12,425 0 comments 1 reaction 1 assignee Assigned to @Copilot View on GitHub
area-app-model area-cli
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

Invoking `aspire run` on following AppHost fails to present a dashboard and ends without producing any error message or error code:

```csharp
#:sdk Aspire.AppHost.Sdk@13.0.0-preview.1.25526.3

var builder = DistributedApplication.CreateBuilder(args);

builder.AddContainer("imageDoesntExistApp", "mcr.microsoft.com/nonexistent/image:latest")
.WithHttpEndpoint(); // <<< OOPS! seems like targetPort is required. aspire prints "Starting dashboard..." and finishes with no error.
// .WithHttpEndpoint(targetPort: 80); // <<< This works...

builder.Build().Run();
```

The apphost isn't expected to result in a successful application -- after all, the container is pointing to an image that doesn't exist. But one would expect that either

1. if `WithHttpEndpoint`'s `targetPort` parameter is an required one, that either at compile time or at runtime there would be an error complaining about it being undefined,
2. the apphost would launch the dashboard where we would see that that container failed to launch

If if instead of using `.WithHttpEndpoint()` one invokes ` .WithHttpEndpoint(targetPort: 80)` we do observe behaviour 2 above. Instead, what we are observing is behaviour 1:

```
$ aspire run || echo ItFailed

⠳ Starting dashboard...
$
```

Also observe that the command ends with a successful exit code.

aspire --version
13.0.0-preview.1.25526.3+4e6589b3f2995a733e241023562f8ef279ba9c79

### Expected Behavior

Launching `aspire run` would result in something like

```plain
$ aspire run

AppHost: apphost.cs

Dashboard: https://localhost:17193/login?t=yadayadayada

Logs: /home/tmacam/.aspire/cli/logs/apphost-27385-2025-10-28-02-08-30.log

Press CTRL+C to stop the apphost and exit.
```

### Steps To Reproduce

Create an single-file project using the code above and run ` aspire run`

### Exceptions (if any)

_No response_

### .NET Version info

10.0.100-rc.2.25502.107

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.