microsoft/aspire · error · InvalidOperationException

Resource ' ' does not have an external HTTP or HTTPS…

Error message

Resource '{resource.Name}' does not have an external HTTP or HTTPS endpoint. Azure Front Door requires an origin to expose an external HTTP or HTTPS endpoint. Call .WithExternalHttpEndpoints() on the resource before adding it as an origin.

What it means

Azure Front Door origins must expose an HTTP or HTTPS endpoint that is marked external. GetOriginEndpoint looks for an external HTTP/HTTPS endpoint annotation on the origin resource and throws this InvalidOperationException when none exists, telling the developer to call WithExternalHttpEndpoints(). This guarantees Front Door has a routable public endpoint for the origin.

Solutions

  1. Call .WithExternalHttpEndpoints() on the origin resource before adding it to the Front Door.
  2. Ensure the endpoint is HTTP or HTTPS (not another scheme) and marked external.
  3. If the resource should not be publicly exposed, expose a dedicated front-end project instead of the internal service.

Example fix

// before
frontDoor.AddOrigin(builder.AddProject<Projects.Frontend>("frontend"));

// after
var frontend = builder.AddProject<Projects.Frontend>("frontend")
    .WithExternalHttpEndpoints();
frontDoor.AddOrigin(frontend);
Defensive patterns

Strategy: validation

Validate before calling

var ok = resource.TryGetEndpoints(out var endpoints) && endpoints.Any(e => e.Endpoint?.IsExternal == true && e.Endpoint.UriScheme is "http" or "https");

Type guard

static bool HasExternalHttpEndpoint(IResourceWithEndpoints r) => r.TryGetEndpoints(out var eps) && eps.Any(e => e.Endpoint?.IsExternal == true && e.Endpoint.UriScheme is "http" or "https");

Try / catch

try { frontDoor.AddOrigin(resource); } catch (InvalidOperationException ex) when (ex.Message.Contains("external HTTP")) { /* call WithExternalHttpEndpoints on the resource */ }

Prevention

When it happens

Trigger: Passing a resource to FrontDoor AddOrigin that has no endpoints, or whose endpoints are all internal/non-HTTP (e.g., default project endpoints, or endpoints added without the external HTTP flags).

Common situations: Adding a project that only listens on internal endpoints; forgetting .WithExternalHttpEndpoints() on the backend service; using a container with only a TCP or gRPC endpoint as an origin.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


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

Appendix: source

Thrown at src/Aspire.Hosting.Azure.FrontDoor/AzureFrontDoorExtensions.cs:230

        }

        throw new InvalidOperationException(
            $"Resource '{resource.Name}' does not have a compute environment. " +
            "Ensure a compute environment (e.g., Azure Container Apps, Azure App Service) is configured in the application model.");
    }

    private static EndpointReference GetOriginEndpoint(IResourceWithEndpoints resource)
    {
        var externalHttpEndpoint = resource.GetEndpoints()
            .Where(e => e.EndpointAnnotation.UriScheme is "http" or "https")
            .FirstOrDefault(e => e.EndpointAnnotation.IsExternal);

        if (externalHttpEndpoint is not null)
        {
            return externalHttpEndpoint;
        }

        throw new InvalidOperationException(
            $"Resource '{resource.Name}' does not have an external HTTP or HTTPS endpoint. " +
            "Azure Front Door requires an origin to expose an external HTTP or HTTPS endpoint. " +
            "Call .WithExternalHttpEndpoints() on the resource before adding it as an origin.");
    }

    private static (string Path, HealthProbeProtocol Protocol) GetProbeSettings(IResourceWithEndpoints resource)
    {
        // Use settings from EndpointProbeAnnotation if available (set by WithHttpProbe).
        // Prefer liveness probes, matching the pattern used by App Service.
        var probeAnnotation = resource.Annotations
            .OfType<EndpointProbeAnnotation>()
            .OrderBy(p => p.Type == ProbeType.Liveness ? 0 : 1)
            .FirstOrDefault();

        if (probeAnnotation is not null)
        {
            var protocol = probeAnnotation.EndpointReference.Scheme == "http"
                ? HealthProbeProtocol.Http

View on GitHub (pinned to 25830f84bd)