Skip to content

SteveHSX7/AspireSample

Repository files navigation

Repo to illustratte issue on Aspire : dotnet/aspire#7682

This is essentially the Aspire Starter project with two small mods :

  1. Add endpoint details and some relicas (>1) to the Api Service project reference :
image
  1. and then a simple logger to show it in the ApiService project :
image

When run locally it works great - two apiservice resources are started :

image

with arbitrary ports on each ("dashboard port" and "dashboard target port"):

image

However when attempting to deploy this scenario to Azure using "azd up" this error is generated :

image

Since making the discussion post I have dug into this a little further and found that when running "azd up --debug" we can see this JSON being used to setup the container app :

2025/03/02 21:37:58 container_app.go:584: setting body to {"identity":{"type":"UserAssigned","userAssignedIdentities":{"/subscriptions/XXXXXXX/resourceGroups/rg-portapp/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mi-7bzyyzka6tzec":{}}},"location":"uksouth","properties":{"configuration":{"activeRevisionsMode":"single","ingress":{"additionalPortMappings":[{"external":false,"targetPort":0}],"allowInsecure":false,"external":true,"targetPort":8000,"transport":"http"},"registries":[{"identity":"/subscriptions/XXX/resourceGroups/rg-portapp/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mi-7bzyyzka6tzec","server":"acr7bzyyzka6tzec.azurecr.io"}],"runtime":{"dotnet":{"autoConfigureDataProtection":true}}},"environmentId":"/subscriptions/XXXX/resourceGroups/rg-portapp/providers/Microsoft.App/managedEnvironments/cae-7bzyyzka6tzec","template":{"containers":[{"env":[{"name":"AZURE_CLIENT_ID","value":"660c92b0-a7da-400a-93da-a212342698f0"},{"name":"APIDASHBOARDPORT","value":"8000"},{"name":"ASPNETCORE_FORWARDEDHEADERS_ENABLED","value":"true"},{"name":"HTTP_PORTS","value":"8080"},{"name":"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES","value":"true"},{"name":"OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES","value":"true"},{"name":"OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY","value":"in_memory"}],"image":"acr7bzyyzka6tzec.azurecr.io/aspire-sample/apiservice-portapp:azd-deploy-1740951475","name":"apiservice"}],"scale":{"minReplicas":1}}},"tags":{"aspire-resource-name":"apiservice","azd-service-name":"apiservice"}}

In particular I suspect this section is the problem :

	"location": "uksouth",
	"properties": {
		"configuration": {
			"activeRevisionsMode": "single",
			"ingress": {
				"additionalPortMappings": [
					{
						"external": false,
						"targetPort": 0
					}
				],

and I think this comes from the launchSettings.json having an applicationUrl in the launch profile being used for that project (either the first one or an explicitly specified one).

If I remove the applicationUrl (or create a new profile without one and reference this in the AppHost) then the deployment works :

AppHost.cs
image

launchSettings.json
image

results in a deployment :

image

Note that my specific problem is related to when integrating Orleans Silo projects with Aspire and the additional Orleans Dashboard which listens on an arbitrary port and provides insight into the Orleans deployment. This project is just to illustrate the problem - there is no 'real' service running on the ports in this repro case.

When running locally we have to ensure each Silo instance (replica) has a different port as of course we can't bind the same port > 1 time when running on localhost.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published