microsoft/aspire · error · NotSupportedException

Endpoint ' ' on resource ' ' uses transport ' '. Azure…

Error message

Endpoint '{endpoint.Name}' on resource '{resource.Name}' uses transport '{endpoint.Transport}'. Azure sandbox ports currently support only HTTP and HTTP/2 endpoints.

What it means

Sandbox ingress ports only support HTTP and HTTP/2. ResolveSandboxPortProtocol maps transport strings 'http'/'http2' to protocol values and throws NotSupportedException for any other transport (e.g. tcp, udp), since those cannot be exposed via the HTTP-based sandbox ingress.

Solutions

  1. Change the endpoint transport to "http" or "http2"
  2. Remove the non-HTTP endpoint from sandbox deployment (keep it internal only)
  3. If non-HTTP exposure is required, use a deployment target that supports raw TCP ports

Example fix

// before
.WithEndpoint(targetPort: 1433, transport: "tcp")
// after
.WithHttpEndpoint(targetPort: 8080)
Defensive patterns

Strategy: validation

Validate before calling

foreach (var ep in resource.Endpoints)
    if (ep.Transport is not ("http" or "http2"))
        throw new InvalidOperationException($"Endpoint '{ep.Name}' transport '{ep.Transport}' unsupported for sandbox.");

Try / catch

try { DeploySandbox(...); } catch (NotSupportedException ex) when (ex.Message.Contains("only HTTP and HTTP/2 endpoints")) { /* switch transport to http/http2 */ }

Prevention

When it happens

Trigger: An endpoint with Transport set to something other than "http" or "http2" (e.g. WithEndpoint(transport: "tcp")) on a resource deployed to an Azure sandbox.

Common situations: Exposing TCP services (databases, gRPC-over-TCP with transport "tcp") through sandbox ingress; default transport assumptions differing between local run and sandbox deploy.

Related errors


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

Appendix: source

Thrown at src/Aspire.Hosting.Azure.Sandboxes/AzureSandboxContainerDeployment.cs:1582

        {
            return targetPort;
        }

        // .NET project publishing uses ContainerPortReference for the shared HTTP/HTTPS
        // destination when no target port is specified. Sandbox ingress terminates TLS,
        // so both app-model endpoints route to the framework's HTTP container port.
        return resource is ProjectResource && endpoint.Endpoint.Transport is "http" or "http2"
            ? DefaultContainerPort
            : null;
    }

    private static string ResolveSandboxPortProtocol(IResource resource, EndpointAnnotation endpoint)
    {
        return endpoint.Transport switch
        {
            "http" => "Http",
            "http2" => "Http2",
            _ => throw new NotSupportedException($"Endpoint '{endpoint.Name}' on resource '{resource.Name}' uses transport '{endpoint.Transport}'. Azure sandbox ports currently support only HTTP and HTTP/2 endpoints.")
        };
    }

    internal static async Task DeleteExistingDeploymentAsync(
        PipelineStepContext context,
        IAzureDevComputeClient client,
        AzureDevComputeResourceScope scope,
        DeploymentStateSection stateSection,
        bool throwOnError)
    {
        List<Exception>? failures = throwOnError ? [] : null;
        var sandboxId = stateSection.Data["SandboxId"]?.GetValue<string>();
        if (!string.IsNullOrWhiteSpace(sandboxId))
        {
            try
            {
                await DeleteSandboxAsync(context, client, scope, sandboxId, GetStatePorts(stateSection), throwOnError).ConfigureAwait(false);
            }

View on GitHub (pinned to 25830f84bd)