-
Notifications
You must be signed in to change notification settings - Fork 733
Closed as duplicate of#6693
Copy link
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When I am restarting the Aspire application, sometimes the ports are still bound from the last run.

This causes the following logs in the app host.
info: Aspire.Hosting.DistributedApplication[0]
Aspire version: 9.0.0+01ed51919f8df692ececce51048a140615dc759d
info: Aspire.Hosting.DistributedApplication[0]
Distributed application starting.
info: Aspire.Hosting.DistributedApplication[0]
Application host directory is: C:\Repos\Revive\src\Hosting\Revive.AppHost
info: Aspire.Hosting.DistributedApplication[0]
Now listening on: https://localhost:17243
info: Aspire.Hosting.DistributedApplication[0]
Login to the dashboard at https://localhost:17243/login?t=c3f11510-4bb8-4bce-ba6f-088ce5e13531
fail: Aspire.Hosting.Dcp.dcpctrl.ServiceReconciler[0]
could not start the proxy {"ServiceName": {"name":"ui"}, "Reconciliation": 3, "error": "could not start the proxy for the service: listen tcp 127.0.0.1:6001: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted."}
fail: Aspire.Hosting.Dcp.dcpctrl.ServiceReconciler[0]
could not start the proxy {"ServiceName": {"name":"api"}, "Reconciliation": 4, "error": "could not start the proxy for the service: listen tcp 127.0.0.1:5001: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted."}
fail: Aspire.Hosting.Dcp.dcpctrl.ServiceReconciler[0]
could not start the proxy {"ServiceName": {"name":"api"}, "Reconciliation": 5, "error": "could not start the proxy for the service: listen tcp 127.0.0.1:5001: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted."}
info: Aspire.Hosting.DistributedApplication[0]
Distributed application started. Press Ctrl+C to shut down.
fail: Aspire.Hosting.Dcp.dcpctrl.ServiceReconciler[0]
could not start the proxy {"ServiceName": {"name":"ui"}, "Reconciliation": 6, "error": "could not start the proxy for the service: listen tcp 127.0.0.1:6001: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted."}
Expected Behavior
The restart should dispose/wait for the ports to be freed and successfully start up.
Steps To Reproduce
We haven't fully gotten the application running within random ports and whatnot. At the moment our UI & API projects are hardcoded ports, 5001 & 6001.
The AppHost is
var builder = DistributedApplication.CreateBuilder(args);
var api = builder.AddProject<Projects.Api>("api");
var ui = builder.AddProject<Projects.Portal>("ui").WithReference(api).WaitFor(api);
builder.Build().Run();Note that the dashboard starts successfully saying the apps are running fine:
Exceptions (if any)
Included exceptions in the app host logs above
.NET Version info
.NET SDK:
Version: 9.0.101
Commit: eedb237549
Workload version: 9.0.100-manifests.4a280210
MSBuild version: 17.12.12+1cce77968
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.101\
.NET workloads installed:
[aspire]
Installation Source: SDK 9.0.100, VS 17.10.35027.167
Manifest Version: 8.2.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Install Type: Msi
[wasm-tools]
Installation Source: SDK 9.0.100
Manifest Version: 9.0.0/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.current\9.0.0\WorkloadManifest.json
Install Type: Msi
[wasm-tools-net8]
Installation Source: SDK 9.0.100
Manifest Version: 9.0.0/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.net8\9.0.0\WorkloadManifest.json
Install Type: Msi
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4
.NET SDKs installed:
8.0.303 [C:\Program Files\dotnet\sdk]
8.0.307 [C:\Program Files\dotnet\sdk]
8.0.404 [C:\Program Files\dotnet\sdk]
9.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
C:\Repos\Revive\global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Anything else?
It sometimes works when clicking restart, and it usually works when hitting stop all, wait a few seconds, then start again.
drazvan91 and jmevel
