Skip to content

[WebToolsE2E][Aspire] Running two Aspire projects with Azure Functions at the same time will cause the 'functionapp1' to stop after a few seconds for one of the projects. #8501

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

Open
vmykagapuz opened this issue Apr 2, 2025 · 9 comments
Labels
area-integrations Issues pertaining to Aspire Integrations packages azure Issues associated specifically with scenarios tied to using Azure azure-functions Issues related to the Azure Functions integration
Milestone

Comments

@vmykagapuz
Copy link

vmykagapuz commented Apr 2, 2025

REGRESSION INFO

  1. Worked in Aspire 9.1.0

INSTALL STEPS

  1. Clean machine: Win11 x64 24h2 ENU
  2. Install VS 17.13.5
  3. Add dotnet9 feed for 9.2.0-preview.1
  4. Install the latest Aspire 9.2.0-preview.1 templates
    dotnet new install Aspire.ProjectTemplates::9.2.0-preview.1.25201.19 --force
  5. Install Docker Desktop

NOTE

  1. This issue reproduces for both 8.0/9.0 framework

REPRO STEPS

  1. New project > .NET Aspire Starter App > .NET 9.0 > .NET Aspire version (9.2) > Create
  2. Right click solution > Add > New Project > Azure Functions > .NET 9.0 Isolated > Check 'Enlist in .NET Aspire orchestration' > Create
  3. Repeat Step 1 and 2 to create another project
  4. Build and run the first project > Check that all the projects are running in Resources
  5. Build and run the second project > Check that the endpoint for 'functionapp1' project stops after few seconds

ACTUAL
The 'functionapp1' for the second project will stop after few seconds.
Image

EXPECTED
The 'functionapp' should run successfully when 2 different projects are run the same time.

@davidfowl
Copy link
Member

Did you look at the logs? Is there a port conflict?

@davidfowl davidfowl added area-integrations Issues pertaining to Aspire Integrations packages azure Issues associated specifically with scenarios tied to using Azure and removed area-tooling labels Apr 2, 2025
@davidfowl davidfowl added this to the 9.2 milestone Apr 2, 2025
@davidfowl davidfowl added the azure-functions Issues related to the Azure Functions integration label Apr 2, 2025
@vmykagapuz
Copy link
Author

I'm not sure which logs I should check, but for the console logs of the project that has 'functionapp1' stopped, this is what it shows:
Image
Image

@davidfowl
Copy link
Member

davidfowl commented Apr 3, 2025

Always the console logs. Download them an attach to the issue.

This is expected, there's a port conflict because the port is specified in the launch settings and you are launching the same project twice.

@vmykagapuz
Copy link
Author

I launched 2 different projects and they dont share the same port for functionapp1

Image

@captainsafia
Copy link
Member

@vmykagapuz Ditto the previous comments. Can you share the logs that are associated with the failure mode where two different ports were used?

If you can upload the code you are running to GH or somewhere that would help as well.

@vmykagapuz
Copy link
Author

Logs for 1st project with no failure:

2025-04-04T06:37:25.9420000Z 
2025-04-04T06:37:25.9480000Z Azure Functions Core Tools
2025-04-04T06:37:25.9910000Z Core Tools Version:       4.0.7030 Commit hash: N/A +bb4c949899cd5659d6bfe8b92cc923453a2e8f88 (64-bit)
2025-04-04T06:37:25.9960000Z Function Runtime Version: 4.1037.0.23568
2025-04-04T06:37:26.0020000Z 
2025-04-04T06:37:27.2700000Z [2025-04-04T06:37:27.186Z] Found C:\Users\v-mykagapuz\source\repos\Aspire9-Iso9\FunctionApp1\FunctionApp1.csproj. Using for user secrets file configuration.
2025-04-04T06:37:27.4320000Z Skipping 'AzureWebJobsStorage' from local settings as it's already defined in current environment variables.
2025-04-04T06:37:27.4620000Z Skipping 'FUNCTIONS_WORKER_RUNTIME' from local settings as it's already defined in current environment variables.
2025-04-04T06:37:37.1720000Z [2025-04-04T06:37:37.019Z] Azure Functions .NET Worker (PID: 19936) initialized in debug mode. Waiting for debugger to attach...
2025-04-04T06:37:37.2440000Z [2025-04-04T06:37:37.238Z] Worker process started and initialized.
2025-04-04T06:37:37.4070000Z 
2025-04-04T06:37:37.4580000Z Functions:
2025-04-04T06:37:37.4670000Z 
2025-04-04T06:37:37.4840000Z 	Function1: [GET,POST] http://localhost:7071/api/Function1
2025-04-04T06:37:37.4870000Z 
2025-04-04T06:37:37.4920000Z For detailed output, run func with --verbose flag.
2025-04-04T06:37:42.6930000Z [2025-04-04T06:37:42.691Z] Host lock lease acquired by instance ID '0000000000000000000000003842D856'.

Logs for 2nd project with failure:

2025-04-04T06:37:55.5790000Z Port 7071 is unavailable. Close the process using that port, or specify another port using --port [-p].
2025-04-04T06:38:23.4170000Z Press any key to continue....

@v-elenafeng
Copy link

@davidfowl @captainsafia @balachir I tried this scenario and found that

Function Apps use port 7071 by default, so when one starts, the other will automatically stop because the port is occupied. When I manually change the default port of one of them, both apps can keep running at the same time.

FunctionApp1
Image

FunctionApp2
Image

@davidfowl davidfowl modified the milestones: 9.2, Backlog Apr 7, 2025
@davidfowl
Copy link
Member

Seems like an issue with the functions templates. Moving out of 9.2. We'll work with the functions team to see if we can do something here with the template.

cc @fabiocav @mattchenderson

@fabiocav
Copy link

Related to #8589

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-integrations Issues pertaining to Aspire Integrations packages azure Issues associated specifically with scenarios tied to using Azure azure-functions Issues related to the Azure Functions integration
Projects
None yet
Development

No branches or pull requests

5 participants