dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.91k stars 475 forks source link

Azure Functions won't start due to port is unavailable exception #6699

Open Depechie opened 5 days ago

Depechie commented 5 days ago

Is there an existing issue for this?

Describe the bug

When running a .NET Aspire solution after the first time, containing an Azure Functions project with the https://learn.microsoft.com/en-us/dotnet/aspire/serverless/functions?tabs=dotnet-cli&pivots=dotnet-cli integration, the functions will not start because of the fact that the configured port is still in use. Seems the cleanup process does not stop all processes.

Expected Behavior

All running processes are stopped when pressing ctrl+c to shut down the running Aspire project

Steps To Reproduce

Create an Aspire project containing an Azure function project Run the Aspire apphost for the first time with dotnet run --project AspireFunctions.AppHost See that the function app is loaded and working Stop the AppHost with ctrl+c Run the Aspire apphost for a second time with dotnet run --project AspireFunctions.AppHost See that the function app fails to start due to port still being in use

Project running on MacOS

Exceptions (if any)

Port 7288 is unavailable

.NET Version info

9.0.100

Anything else?

Project running on MacOS List running processes with sudo lsof -i -P -n | grep LISTEN and see that dotnet still has running items

Image