microsoft/aspire · error · DistributedApplicationException
Could not create for resource ' ' as no endpoint was found…
Error message
Could not create {errorDisplayNoun} for resource '{builder.Resource.Name}' as no endpoint was found matching one of the specified names: {endpointNamesString} What it means
When creating an HTTP-based resource command, Aspire searches the resource's endpoints for one matching any of the configured candidate endpoint names. If none matches, it throws DistributedApplicationException listing all names it searched for.
Solutions
- Add a WithEndpoint/WithHttpEndpoint call matching one of the expected names on the resource
- Pass an explicit endpoint name that matches the resource's declared endpoint
- Check for spelling/case differences between the configured endpoint names and the actual endpoint annotations
Example fix
// before .WithHttpCommand(..., endpointName: "https") // resource only declares "http" // after .WithEndpoint(name: "https", scheme: "https", port: 8080) // or use endpointName: "http"
Defensive patterns
Strategy: validation
Validate before calling
var names = resource.GetEndpoints().Select(e => e.EndpointName).ToHashSet(StringComparer.OrdinalIgnoreCase);
var missing = candidateNames.Where(n => !names.Contains(n)).ToList();
if (missing.Count == candidateNames.Count)
throw new InvalidOperationException($"No endpoint matches any of: {string.Join(", ", candidateNames)}"); Type guard
bool HasAnyNamedEndpoint(IResourceWithEndpoints r, IEnumerable<string> wanted) =>
r.GetEndpoints().Any(e => wanted.Contains(e.EndpointName, StringComparer.OrdinalIgnoreCase)); Try / catch
try { builder.WithHttpCommand(...); }
catch (DistributedApplicationException ex) when (ex.Message.Contains("no endpoint was found matching")) { /* declare the endpoint or correct the name */ } Prevention
- Match endpoint names exactly as declared in WithEndpoint
- Declare required endpoints unconditionally if HTTP commands depend on them
- Log available endpoint names when configuring commands to catch renames early
When it happens
Trigger: Calling WithHttpCommand-style APIs where the resource has no endpoint whose EndpointName matches any of the configured names — e.g. the resource never called WithEndpoint, or the endpoint name differs in case/spelling from the configured candidates.
Common situations: Assuming the default endpoint is named 'http'/'https' when it was named something custom like 'webui'; endpoints added conditionally so they are missing at command creation; renaming an endpoint without updating command configuration.
Related errors
- BrowserMessageStrings.BrowserLogsResourceMissingHttpEndpoint
- Could not create for resource ' ' as the endpoint with name…
- Could not create HTTP command for resource
- BrowserMessageStrings.BrowserLogsEndpointNotAllocated
- Could not create HTTP command for resource
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/29e8c6bf821679e5.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting/ResourceBuilderExtensions.cs:4390
var endpoints = builder.Resource.GetEndpoints();
EndpointReference? matchingEndpoint = null;
foreach (var name in endpointNames)
{
matchingEndpoint = endpoints.FirstOrDefault(e => string.Equals(e.EndpointName, name, StringComparisons.EndpointAnnotationName));
if (matchingEndpoint is not null)
{
if (!s_httpSchemes.Contains(matchingEndpoint.Scheme, StringComparers.EndpointAnnotationUriScheme))
{
throw new DistributedApplicationException($"Could not create {errorDisplayNoun} for resource '{builder.Resource.Name}' as the endpoint with name '{matchingEndpoint.EndpointName}' and scheme '{matchingEndpoint.Scheme}' is not an HTTP endpoint.");
}
return matchingEndpoint;
}
}
// No endpoint found with the specified names
var endpointNamesString = string.Join(", ", endpointNames);
throw new DistributedApplicationException($"Could not create {errorDisplayNoun} for resource '{builder.Resource.Name}' as no endpoint was found matching one of the specified names: {endpointNamesString}");
};
private static Func<EndpointReference> DefaultEndpointSelector<TResource>(IResourceBuilder<TResource> builder)
where TResource : IResourceWithEndpoints
=> () =>
{
// Use the first HTTP endpoint (preferring HTTPS over HTTP), otherwise throw an exception if no endpoint is found.
var endpoints = builder.Resource.GetEndpoints();
EndpointReference? matchingEndpoint = null;
foreach (var scheme in s_httpSchemes)
{
matchingEndpoint = endpoints.FirstOrDefault(e => string.Equals(e.EndpointName, scheme, StringComparisons.EndpointAnnotationUriScheme));
if (matchingEndpoint is not null)
{
return matchingEndpoint;
}
}View on GitHub (pinned to 25830f84bd)