aspire: [WebToolsE2E][Aspire] For a Function App with Aspire 9.2, the port number in console logs is always 7071 and does not match the port number in the dashboard
REGRESSION INFO
Worked in Aspire 9.1.0
INSTALL STEPS
- Clean machine: Win11 x64 24h2 ENU
- Install VS 17.13 (latest released version)
- Install Aspire.ProjectTemplates 9.1.0
- Install Aspire.ProjectTemplates 9.2.0
MINIMAL REPRO
REPRO STEPS
- New Function App > enable Aspire > choose Aspire 9.2 > FunctionApp10
- Check FunctionApp10.AppHost.csproj to use Aspire 9.2
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.2.0" />
<PackageReference Include="Aspire.Hosting.Azure.Functions" Version="9.2.0-preview.1.25206.1" />
- Open FunctionApp10.AppHost\Program.cs and Ctrl + F5 (run without debugging)
ACTUAL Port number in console logs is 7071 but the one shown in the dashboard is 7045
EXPECTED
Port number in console logs should match with the one in the dashboard – both should be 7045
DETAILED REPRO (if you want to compare behavior with Aspire 9.1)
REPRO STEPS
With Aspire 9.1
- New Function App > enable Aspire > choose Aspire 9.1 > FunctionApp9
- Make sure that FunctionApp9.AppHost.csproj points to Aspire 9.1
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.1.0" />
<PackageReference Include="Aspire.Hosting.Azure.Functions" Version="9.1.0-preview.*" />
- The launchSettings.json of FunctionApp9 is configured to use port 7086
- Open FunctionApp9.AppHost\Program.cs and Ctrl + F5 (run without debugging)
- Works fine - Aspire dashboard, console logs shows the localhost:7086 and the page loads successfully
With Aspire 9.2
- Update FunctionApp9.AppHost.csproj to use Aspire 9.2
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.2.0" />
<PackageReference Include="Aspire.Hosting.Azure.Functions" Version="9.2.0-preview.*" />
- Open FunctionApp9.AppHost\Program.cs and Ctrl + F5 (run without debugging)
ACTUAL The URL (port number) shown in the Aspire dashboard does not match the port number used in the console logs
EXPECTED The same port number should show up in the console logs as the dashboard URL. The page should load successfully as we saw with the Aspire 9.1 case above.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 11
- Comments: 40 (19 by maintainers)
As a workaround I’ve downgraded only
Aspire.Hosting.Azure.Functionsto9.1.0-preview.1.25121.10. It now launches on the port I specified.Other Aspire packages I left on
9.2.1.The port was wrong for me too (defaulted to 7071) when booting in VS (Version 17.13.6) on 9.3.0-preview.1.25265.20 and 9.3.1-preview.1.25305.6.
However, the port was correct when I booted Aspire in the terminal with
dotnet run. This was for both 9.3.0-preview.1.25265.20 and 9.3.1-preview.1.25305.6.Booting in VS worked when I reverted to 9.1.0-preview.1.25121.10.
I’m having the exact same issue with Aspire 9.3.0 - I’m using Jetbrains Rider.
When there are launchSettings.json present in the FunctionApp the
--portnumber is extracted from that and applied toWithHttpEndpoint()on the Functions resource builder and I assume that this endpoint is visible at the dashboard.I suspect that the context arguments aren’t set appropriately. When the launchSettings.json isn’t available another port will be picked (somehow) and this port is set to the context arguments.
I may be wrong since I’m an Aspire newbie but it’s verrrry confusing 😃
With LaunchSettings.json
Without LaunchSettings.json
portis null and will applycontext.Args(..)at line 195I was looking at it but got side tracked with some blocking debugger attach issue.