microsoft/aspire · error · NotSupportedException

The endpoint ' ' on resource ' ' is not external. App…

Error message

The endpoint '{endpoint.Name}' on resource '{resource.Name}' is not external. App Service only supports external endpoints.

What it means

App Service publishing only models publicly reachable HTTP(S) sites, so ProcessEndpoints requires every endpoint on the resource to be external. If a resolved endpoint has IsExternal == false, this NotSupportedException is thrown naming the endpoint and resource.

Solutions

  1. Add .WithExternalHttpEndpoints() to the project's HTTP endpoint(s).
  2. Remove the non-external endpoint if it is not needed in the App Service deployment.
  3. Set environment.PreserveHttpEndpoints/scheme configuration appropriately and mark the endpoint external when publishing to App Service.

Example fix

// before
var api = builder.AddProject<Projects.Api>("api").WithHttpEndpoint(port: 8080, name: "http");
// after
var api = builder.AddProject<Projects.Api>("api").WithHttpEndpoint(port: 8080, name: "http").WithExternalHttpEndpoints();
Defensive patterns

Strategy: validation

Validate before calling

var nonExternal = project.Annotations.OfType<EndpointAnnotation>()
    .Where(e => !e.IsExternal).ToList();
if (nonExternal.Count > 0)
    throw new NotSupportedException($"All endpoints must be external for App Service: {string.Join(", ", nonExternal.Select(e => e.Name))}");

Try / catch

try { await environmentContext.ProcessAsync(); }
catch (NotSupportedException ex) when (ex.Message.Contains("is not external"))
{
    logger.LogError(ex, "Add WithExternalHttpEndpoints() to the project before publishing to App Service.");
    throw;
}

Prevention

When it happens

Trigger: A project published to App Service contains an endpoint without WithExternalHttpEndpoints() (or declared as non-external), e.g. .WithHttpEndpoint(port: 8080, name: "http") with no external flag, and the AppService transformer processes it.

Common situations: Projects that mix internal-only and public endpoints; forgetting WithExternalHttpEndpoints after renaming endpoints; endpoints used solely for health checks or internal references.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebsiteContext.cs:130

            .Where(r => r.Endpoint.IsExternal)
            .Select(r => r.TargetPort.Value)
            .Distinct()
            .ToList();

        if (targetPortEndpoints.Count > 1)
        {
            throw new NotSupportedException("App Service does not support resources with multiple external endpoints.");
        }

        var preserveHttp = environmentContext.Environment.PreserveHttpEndpoints;

        foreach (var resolved in resolvedEndpoints)
        {
            var endpoint = resolved.Endpoint;

            if (!endpoint.IsExternal)
            {
                throw new NotSupportedException($"The endpoint '{endpoint.Name}' on resource '{resource.Name}' is not external. App Service only supports external endpoints.");
            }

            // By default, HTTP endpoints are upgraded to HTTPS in App Service
            // If PreserveHttpEndpoints is true, keep the original scheme
            var scheme = preserveHttp ? endpoint.UriScheme : "https";
            var port = scheme is "http" ? 80 : 443;

            // For App Service, we ignore port mappings since ports are handled by the platform
            // TargetPort is null only for default ProjectResource endpoints (container port decides)
            _endpointMapping[endpoint.Name] = new(
                Scheme: scheme,
                Host: HostName,
                Port: port,
                TargetPort: resolved.TargetPort,
                IsHttpIngress: true,
                External: true); // All App Service endpoints are external
        }

View on GitHub (pinned to 25830f84bd)