microsoft/aspire · error · InvalidOperationException

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

Error message

Resource '{parentResource.Name}' does not have an HTTP or HTTPS endpoint. Browser debugging requires an endpoint to navigate to.

What it means

The browser debugger resource created by AddBrowserDebuggerResource needs a URL to navigate to in order to launch a browser attached to the app. This error is thrown when the parent resource has no endpoint with the https or http URI scheme, so there is nothing to navigate to. It is a configuration error on the target resource, not a runtime network failure.

Solutions

  1. Add an HTTP endpoint to the resource, e.g. .WithHttpEndpoint(port: 5050) or .WithHttpEndpoint(targetPort: 8080).
  2. Prefer adding an HTTPS endpoint (.WithHttpsEndpoint) so the debugger picks the secure scheme.
  3. Verify the endpoint is declared before WithBrowserDebugger in the fluent chain.
  4. Check you are calling WithBrowserDebugger on the web project, not a worker/API-only resource.

Example fix

// before
var client = builder.AddProject<Projects.MyApp>("app").WithBrowserDebugger();

// after
var client = builder.AddProject<Projects.MyApp>("app")
    .WithHttpEndpoint(port: 5050)
    .WithBrowserDebugger();
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the resource has an HTTP(S) endpoint before enabling browser debugging
var resource = builder.AddProject<Projects.MyApp>("app")
    .WithHttpEndpoint(port: 5050); // must exist before WithBrowserDebugger()

Try / catch

try { builder.AddBrowserDebuggerResource(parentResource, ...); }
catch (InvalidOperationException ex) when (ex.Message.Contains("does not have an HTTP or HTTPS endpoint"))
{ logger.LogError(ex, "Add an http/https endpoint before browser debugging"); throw; }

Prevention

When it happens

Trigger: Calling .WithBrowserDebugger() (AddBrowserDebuggerResource) on a project/container resource that only has non-HTTP endpoints (e.g. tcp-only bindings), or on a resource whose endpoints have not been declared with WithEndpoint/WithHttpEndpoint.

Common situations: Attaching browser debugging to a background worker or gRPC-only service; forgetting WithExternalHttpEndpoints or WithEndpoint on the target resource; renaming endpoints to custom schemes.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at src/Aspire.Hosting.Blazor/BrowserDebuggerHelper.cs:110

            {
                ResourceType = "BrowserDebugger",
                Properties = [],
                IsHidden = true
            })
            .WithDebugSupport(
                mode =>
                {
                    // Resolve the parent's endpoint at runtime to get the actual allocated URL.
                    EndpointAnnotation? endpointAnnotation = null;
                    if (parentResource.TryGetAnnotationsOfType<EndpointAnnotation>(out var endpoints))
                    {
                        endpointAnnotation = endpoints.FirstOrDefault(e => e.UriScheme == "https")
                            ?? endpoints.FirstOrDefault(e => e.UriScheme == "http");
                    }

                    if (endpointAnnotation is null)
                    {
                        throw new InvalidOperationException(
                            $"Resource '{parentResource.Name}' does not have an HTTP or HTTPS endpoint. " +
                            "Browser debugging requires an endpoint to navigate to.");
                    }

                    var endpointReference = parentResource.GetEndpoint(endpointAnnotation.Name);
                    var appUrl = relativePath is not null
                        ? $"{endpointReference.Url}/{relativePath}/"
                        : endpointReference.Url;
                    // DCP materializes launch configurations during startup. When discovery found
                    // no client, the command stays hidden and this placeholder is never launched.
                    var clientProjectPath = clientProjectPathProvider() ?? workingDirectory;

                    return new BrowserLaunchConfiguration
                    {
                        Mode = mode,
                        Url = appUrl,
                        WebRoot = clientProjectPath,
                        Browser = browser

View on GitHub (pinned to 25830f84bd)