microsoft/aspire · error · DistributedApplicationException

App Service configuration validation failed. See errors…

Error message

App Service configuration validation failed. See errors above.

What it means

ValidateAppServiceConfigurationAsync runs a validation step in the publish pipeline that collects App Service configuration errors and reports them through the activity reporter. If any validation errors were found, the step is completed with an error state and a DistributedApplicationException is thrown to halt the pipeline; the actionable details were already printed above this message.

Solutions

  1. Read the errors printed above this message in the publish output — they identify the exact failing resources and rules.
  2. Fix each reported App Service configuration issue (environment, registry, slots, customizations).
  3. Re-run publish and confirm the 'App Service configuration validated' success step completes.
  4. If errors are unclear, run with more verbose output to capture the per-error reporter entries.

Example fix

// before (workflow)
// hit 'App Service configuration validation failed' and stop without reading details
// after (workflow)
// 1. read the reported validation errors above the throw
// 2. fix e.g. missing AddAzureAppServiceEnvironment / registry
// 3. re-run publish
Defensive patterns

Strategy: try-catch

Try / catch

try { await PublishAsync(); } catch (DistributedApplicationException ex) when (ex.Message.StartsWith("App Service configuration validation failed")) { // per-resource errors were already reported above; surface the full publish log to the user }

Prevention

When it happens

Trigger: Publishing an AppHost whose App Service resources violate configuration rules — the individual rule failures (reported earlier in the output) trigger this aggregate throw from the validation step, invoked via validateStep.

Common situations: Invalid or conflicting App Service settings (missing environment, bad registry, slot issues) during publish-mode runs; CI publish runs failing after per-resource validation messages appear in logs.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

                // Context not found for this resource - skip
            }
        }

        if (errors.Count > 0)
        {
            // Report each error through the activity reporter for user-friendly display
            foreach (var error in errors)
            {
                context.ReportingStep.Log(LogLevel.Error, error);
            }

            await context.ReportingStep.CompleteAsync(
                "App Service configuration validation failed",
                CompletionState.CompletedWithError,
                context.CancellationToken).ConfigureAwait(false);

            // Throw to stop the pipeline - the error has already been reported through the activity reporter
            throw new DistributedApplicationException("App Service configuration validation failed. See errors above.");
        }

        await context.ReportingStep.CompleteAsync(
            "App Service configuration validated",
            CompletionState.Completed,
            context.CancellationToken).ConfigureAwait(false);
    }

    private static string? ValidateEnvironmentVariableNames(IResource resource, AzureAppServiceWebsiteContext appServiceContext)
    {
        if (resource.HasAnnotationOfType<AzureAppServiceIgnoreEnvironmentVariableChecksAnnotation>())
        {
            return null;
        }

        // Azure App Service removes '-' from environment variable names at runtime.
        // This breaks configuration binding for connection strings that use dashed names.
        var problematicKeys = appServiceContext.EnvironmentVariables.Keys

View on GitHub (pinned to 25830f84bd)