-
Notifications
You must be signed in to change notification settings - Fork 562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to bind to address already in use #8021
Comments
Check for a process called dcp running on the machine |
Hi, are you referencing this workaroud issues/6704#issuecomment-2487583280 ? If so, ss -lptn 'sport = :17128'
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 511 127.0.0.1:17128 0.0.0.0:* Failed to bind to address https://127.0.0.1:17128 Second run, stop forwarding 17128, workoarund is not in place yet Failed to bind to address https://127.0.0.1:17128 Third run, no forwarding port, no process is using 17128, workaround checks for any "dcpctrl" and "dcp" (the second one is redundant maybe) AppHost Program.cs now looks like this using System.Diagnostics;
using CommunityToolkit.Aspire.Hosting.Dapr;
EnsureDeveloperControlPaneIsNotRunning();
IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(args);
builder.AddProject<Projects.DistributedAspireDapr_Insurance_Core>(name: "core-api")
.WithDaprSidecar(new DaprSidecarOptions
{
AppId = "core-api"
});
builder.Build().Run();
void EnsureDeveloperControlPaneIsNotRunning()
{
// The Aspire Developer Control Pane process name
string[] toBeKilled = ["dcpctrl", "dcp"];
foreach (var processToBeKilled in toBeKilled)
{
Process? process = Process.GetProcesses()
.SingleOrDefault(p => p.ProcessName.Contains(processToBeKilled, StringComparison.OrdinalIgnoreCase));
if (process == null) return;
Console.WriteLine($"Shutting down developer control pane from previous run. Process: {process.ProcessName} (ID: {process.Id})");
Thread.Sleep(TimeSpan.FromSeconds(5)); // Allow Docker containers to shut down to avoid orphaned containers
try
{
process.Kill();
Console.WriteLine($"Process {process.Id} killed successfully.");
}
catch (Exception ex)
{
Console.WriteLine($"Failed to kill process {process.Id}: {ex.Message}");
}
}
} No process is found to be killed, Failed to bind to address https://127.0.0.1:17128 Is there anything else that i can do? |
I've tried running a sample project with the new devcontainer support on a couple machines and haven't managed to reproduce the issue with a similarly configured App Host. Are you able to share your devcontainer.json so we can see if something in your setup may be causing an issue? Additionally, does the issue reproduce if you run outside of a devcontainer? |
Hi, thanks for your reply! Sure, here my devcontainer definition {
"name": "C# (.NET)",
"image": "mcr.microsoft.com/devcontainers/dotnet:1-9.0-bookworm",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/devcontainers/features/python:1": {},
"ghcr.io/devcontainers/features/rust:1": {},
"ghcr.io/eitsupi/devcontainer-features/duckdb-cli:1": {},
"ghcr.io/shyim/devcontainers-features/bun:0": {},
"ghcr.io/jsburckhardt/devcontainer-features/uv:1": {},
"ghcr.io/dapr/cli/dapr-cli:0": {},
"ghcr.io/devcontainers-community/npm-features/typescript:1": {},
"ghcr.io/nikiforovall/devcontainer-features/dotnet-csharpier:1": {},
"ghcr.io/devcontainers-extra/features/poetry:2": {},
"ghcr.io/dotnet/aspire-devcontainer-feature/dotnetaspire:1": {}
},
"onCreateCommand": "export PATH=$PATH:/home/vscode/.dapr/bin",
"postStartCommand": "dotnet dev-certs https --trust",
"runArgs": [
"--network=host"
]
} What's the new devcontainer support? C# Dev Kit new version or pre-release? |
Sorry, I just meant the Aspire devcontainer feature that was recently added (and you are using in your config). I’ll do some testing with host networking mode today to see if that could be causing the behavior you’re seeing. |
I've done some additional testing with host networking and |
Is there an existing issue for this?
Describe the bug
No matter what i do Aspire Dashboard always crash, hanging and crashing VsCode.
Tried to change the port bumping the number, killing previous process and rebuilding devcontainer.
Environment
AppHost Program.cs
AppHost launchSettings.json
Logs
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version info
.NET SDK:
Version: 9.0.200
Commit: 90e8b202f2
Workload version: 9.0.200-manifests.b4a8049f
MSBuild version: 17.13.8+cbc39bea8
Runtime Environment:
OS Name: debian
OS Version: 12
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/9.0.200/
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.2
Architecture: x64
Commit: 80aa709f5d
.NET SDKs installed:
9.0.101 [/usr/share/dotnet/sdk]
9.0.200 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/usr/share/dotnet]
global.json file:
Not found
Anything else?
No response
The text was updated successfully, but these errors were encountered: