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
- Call .WithExternalHttpEndpoints() on the origin resource before adding it to the Front Door.
- Ensure the endpoint is HTTP or HTTPS (not another scheme) and marked external.
- 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
- Chain .WithExternalHttpEndpoints() on every service used as a Front Door origin.
- Confirm the endpoint scheme is http/https and external.
- Review endpoint configuration before publishing.
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
- Resource ' ' does not have a compute environment. Ensure a…
- AllocatedEndpoint must use the same network as the…
- Cannot find a http or https endpoint for this resource.
- Could not create HTTP command for resource
- Could not create HTTP probe for resource
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.HttpView on GitHub (pinned to 25830f84bd)