microsoft/aspire · error · NotSupportedException

Multiple external endpoints are not supported

Error message

Multiple external endpoints are not supported

What it means

A Container App can expose at most one external ingress endpoint. During endpoint processing Aspire groups endpoints by target port; if more than one group (or endpoint) is marked External, it throws this NotSupportedException. Keep a single external endpoint and expose additional services internally.

Solutions

  1. Mark only one endpoint as external; make the rest internal (isExternal: false).
  2. Split the service into two projects/resources if both need separate public exposure.
  3. Front additional routes through the single external ingress (path-based routing).

Example fix

// before
.WithHttpEndpoint(port: 8080, name: "http", isExternal: true)
.WithHttpEndpoint(port: 9090, name: "metrics", isExternal: true)

// after
.WithHttpEndpoint(port: 8080, name: "http", isExternal: true)
.WithHttpEndpoint(port: 9090, name: "metrics", isExternal: false)
Defensive patterns

Strategy: validation

Validate before calling

var externalCount = resource.GetEndpoints().Count(e => e.Endpoint.IsExternal);
if (externalCount > 1) throw new InvalidOperationException("Container Apps allow only one external endpoint.");

Type guard

bool HasSingleExternalEndpoint(IResource r) => r.Annotations.OfType<EndpointAnnotation>().Count(a => a.IsExternal) <= 1;

Try / catch

try { /* build/publish */ } catch (NotSupportedException ex) when (ex.Message == "Multiple external endpoints are not supported") { /* demote extra endpoints to internal */ }

Prevention

When it happens

Trigger: Marking two or more endpoints as external (WithEndpoint(..., isExternal: true), WithHttpEndpoint(isExternal: true), or external: true) on the same resource published to Container Apps.

Common situations: Exposing both an HTTP API and a metrics/health UI publicly on one app; migrating from Kubernetes (multiple external Services) where Container Apps' single-ingress model is stricter.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/744fa905b373143b. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.Azure.AppContainers/ContainerAppContext.cs:173

            .GroupBy(x => x.resolved.TargetPort.Value)
            .Select(g => new
            {
                Port = g.Key,
                ResolvedEndpoints = g.Select(x => x.resolved).ToArray(),
                External = g.Any(x => x.resolved.Endpoint.IsExternal),
                IsHttpOnly = g.All(x => x.resolved.Endpoint.Transport is "http" or "http2"),
                AnyH2 = g.Any(x => x.resolved.Endpoint.Transport is "http2"),
                UniqueTransports = g.Select(x => x.resolved.Endpoint.Transport).Distinct().ToArray(),
                Index = g.Min(x => x.index)
            })
            .ToList();

        // Failure cases

        // Multiple external endpoints are not supported
        if (endpointsByTargetPort.Count(g => g.External) > 1)
        {
            throw new NotSupportedException("Multiple external endpoints are not supported");
        }

        // Any external non-http endpoints are not supported
        if (endpointsByTargetPort.Any(g => g.External && !g.IsHttpOnly))
        {
            throw new NotSupportedException("External non-HTTP(s) endpoints are not supported");
        }

        // Don't allow mixing http and tcp transports on the same target port
        static bool Compatible(string[] transports) =>
            transports.All(t => t is "http" or "http2") || transports.All(t => t is "tcp");

        if (endpointsByTargetPort.Any(g => !Compatible(g.UniqueTransports)))
        {
            throw new NotSupportedException("HTTP(s) and TCP endpoints cannot be mixed");
        }

        // Get all http only groups

View on GitHub (pinned to 25830f84bd)