microsoft/aspire · error · NotSupportedException

The endpoint(s) '"))} on resource ' ' specifies an…

Error message

The endpoint(s) {string.Join(", ", unsupportedEndpoints.Select(r => $"'{r.Endpoint.Name}'"))} on resource '{resource.Name}' specifies an unsupported scheme. Only http and https are supported in App Service.

What it means

During ProcessEndpoints, AzureAppServiceWebsiteContext validates that every endpoint on the project uses http or https, because Azure App Service front-ends only expose those schemes. If any resolved endpoint uses another UriScheme (e.g. tcp, udp), a NotSupportedException is thrown naming the offending endpoints and resource.

Solutions

  1. Change unsupported endpoints to scheme "http" or "https" in the AppService-published project.
  2. Remove endpoints that are not meant to be exposed publicly (non-external service-to-service ports) before publishing to App Service.
  3. Split the workload: keep non-HTTP endpoints in a container-based deployment target instead of App Service.

Example fix

// before
builder.AddProject<Projects.Api>("api").WithEndpoint("metrics", e => e.WithScheme("tcp"));
// after
builder.AddProject<Projects.Api>("api")
    .WithEndpoint("metrics", e => { e.WithScheme("http"); e.WithExternalHttpEndpoints(); });
Defensive patterns

Strategy: validation

Validate before calling

var bad = project.Annotations.OfType<EndpointAnnotation>()
    .Where(e => e.UriScheme is not ("http" or "https")).ToList();
if (bad.Count > 0)
    throw new NotSupportedException($"Endpoints [{string.Join(", ", bad.Select(b => b.Name))}] must be http/https for App Service.");

Try / catch

try { await environmentContext.ProcessAsync(); }
catch (NotSupportedException ex) when (ex.Message.Contains("unsupported scheme"))
{
    logger.LogError(ex, "Project has non-HTTP(S) endpoints; fix schemes before publishing to App Service.");
    throw;
}

Prevention

When it happens

Trigger: A project resource being published to App Service has an endpoint declared with WithEndpoint/scheme other than http/https — e.g. endpoint1.WithPort(808, "tcp") or a custom scheme — and the resource is processed by the AppService publish transformer.

Common situations: Projects that also expose gRPC-over-TCP, database ports, or custom service endpoints that work locally under the app host but are illegal on App Service; copy-pasted WithEndpoint calls with scheme "tcp"; forgetting that only the HTTP(S) front-end is modeled.

Related errors


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

Appendix: source

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

            }
        }
    }

    private void ProcessEndpoints()
    {
        // Resolve endpoint ports using the centralized helper
        var resolvedEndpoints = resource.ResolveEndpoints();

        if (resolvedEndpoints.Count == 0)
        {
            return;
        }

        // Only http/https are supported in App Service
        var unsupportedEndpoints = resolvedEndpoints.Where(r => r.Endpoint.UriScheme is not ("http" or "https")).ToArray();
        if (unsupportedEndpoints.Length > 0)
        {
            throw new NotSupportedException($"The endpoint(s) {string.Join(", ", unsupportedEndpoints.Select(r => $"'{r.Endpoint.Name}'"))} on resource '{resource.Name}' specifies an unsupported scheme. Only http and https are supported in App Service.");
        }

        // App Service supports only one target port
        var targetPortEndpoints = resolvedEndpoints
            .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)
        {

View on GitHub (pinned to 25830f84bd)