microsoft/aspire · error · InvalidOperationException

The property ' ' is not supported for the endpoint ' '.

Error message

The property '{property}' is not supported for the endpoint '{endpoint.Name}'.

What it means

AzureAppServiceEnvironmentResource.GetEndpointPropertyExpression builds ReferenceExpressions for endpoint properties (Host, Port, Scheme, HostAndPort, etc.) used to parameterize App Service resources. When the requested EndpointProperty is not one of the supported members, the switch falls through to its discard arm and throws this InvalidOperationException. It signals that a caller asked for an endpoint property the App Service publishing model cannot express.

Solutions

  1. Check which EndpointProperty value is being requested and only request supported ones: Host, Port, Scheme, HostAndPort, TlsEnabled, TargetPort.
  2. Align Aspire.Hosting and Aspire.Hosting.Azure.AppService package versions so the enum and the switch are from the same release.
  3. If you own the calling code, map the unsupported property yourself (e.g. resolve IPV4Host to the host expression) before calling this API.
  4. If a newly added EndpointProperty is legitimately needed for App Service, update the switch in GetEndpointPropertyExpression to handle it.

Example fix

// before
var expr = environmentResource.GetEndpointPropertyExpression(endpointReference, EndpointProperty.IPV4Host, ...);
// after
// IPV4Host is not supported for App Service; use Host instead
var expr = environmentResource.GetEndpointPropertyExpression(endpointReference, EndpointProperty.Host, ...);
Defensive patterns

Strategy: validation

Validate before calling

static bool IsSupportedAppServiceEndpointProperty(EndpointProperty p) =>
    p is EndpointProperty.Host or EndpointProperty.Port or EndpointProperty.Scheme
        or EndpointProperty.HostAndPort or EndpointProperty.TlsEnabled or EndpointProperty.TargetPort;

Type guard

if (property is not (EndpointProperty.Host or EndpointProperty.Port or EndpointProperty.Scheme or EndpointProperty.HostAndPort or EndpointProperty.TlsEnabled or EndpointProperty.TargetPort))
    throw new ArgumentException($"{property} is not supported for App Service endpoints.");

Try / catch

try { var expr = env.GetEndpointPropertyExpression(epRef, property); }
catch (InvalidOperationException ex) when (ex.Message.Contains("is not supported for the endpoint"))
{
    logger.LogWarning(ex, "Unsupported endpoint property {Property}; falling back to Host", property);
    expr = env.GetEndpointPropertyExpression(epRef, EndpointProperty.Host);
}

Prevention

When it happens

Trigger: Calling GetEndpointPropertyExpression (directly or via publish-model code that resolves endpoint references for App Service) with an EndpointProperty value outside {Host, Port, Scheme, HostAndPort, TlsEnabled, TargetPort} — e.g. IPV4Host or a newly added EndpointProperty enum member that App Service publishing has not been taught to map.

Common situations: A newer Aspire version adds an EndpointProperty member (e.g. IPV4Host) and custom publishing code or an older/newer package mix requests it against App Service environments; custom resource/endpoint expression generation in extension code passes an unexpected property; version skew between Aspire.Hosting and Aspire.Hosting.Azure.AppService packages.

Related errors


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

Appendix: source

Thrown at src/Aspire.Hosting.Azure.AppService/AzureAppServiceEnvironmentResource.cs:539

        var property = endpointReferenceExpression.Property;
        var endpoint = endpointReference.EndpointAnnotation;
        var scheme = PreserveHttpEndpoints ? endpoint.UriScheme : "https";
        var port = string.Equals(scheme, "http", StringComparison.OrdinalIgnoreCase) ? 80 : 443;
        var tlsEnabled = string.Equals(scheme, "https", StringComparison.OrdinalIgnoreCase) || endpoint.TlsEnabled;
        var host = GetHostAddressExpression(endpointReference);

        return property switch
        {
            EndpointProperty.Url => ReferenceExpression.Create($"{scheme}://{host}"),
            EndpointProperty.Host or EndpointProperty.IPV4Host => host,
            EndpointProperty.Port => ReferenceExpression.Create($"{port.ToString(CultureInfo.InvariantCulture)}"),
            EndpointProperty.TargetPort => endpoint.TargetPort is int targetPort
                ? ReferenceExpression.Create($"{targetPort.ToString(CultureInfo.InvariantCulture)}")
                : ReferenceExpression.Create($"{new ContainerPortReference(endpointReference.Resource)}"),
            EndpointProperty.Scheme => ReferenceExpression.Create($"{scheme}"),
            EndpointProperty.HostAndPort => host,
            EndpointProperty.TlsEnabled => ReferenceExpression.Create($"{(tlsEnabled ? bool.TrueString : bool.FalseString)}"),
            _ => throw new InvalidOperationException($"The property '{property}' is not supported for the endpoint '{endpoint.Name}'.")
        };
    }

    /// <inheritdoc/>
    public override ProvisionableResource AddAsExistingResource(AzureResourceInfrastructure infra)
    {
        var bicepIdentifier = this.GetBicepIdentifier();
        var resources = infra.GetProvisionableResources();

        // Check if an AppServicePlan with the same identifier already exists
        var existingPlan = resources.OfType<AppServicePlan>().SingleOrDefault(plan => plan.BicepIdentifier == bicepIdentifier);

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

        // Create and add new resource if it doesn't exist

View on GitHub (pinned to 25830f84bd)