{"record":{"id":"b2f33cacd4c15b05","repo":"microsoft/aspire","slug":"the-endpoint-endpoint-name-on-resource-resource-name-is-not","errorCode":null,"errorMessage":"The endpoint '{endpoint.Name}' on resource '{resource.Name}' is not external. App Service only supports external endpoints.","messagePattern":"The endpoint '(.+?)' on resource '(.+?)' is not external\\. App Service only supports external endpoints\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebsiteContext.cs","lineNumber":130,"sourceCode":"            .Where(r => r.Endpoint.IsExternal)\n            .Select(r => r.TargetPort.Value)\n            .Distinct()\n            .ToList();\n\n        if (targetPortEndpoints.Count > 1)\n        {\n            throw new NotSupportedException(\"App Service does not support resources with multiple external endpoints.\");\n        }\n\n        var preserveHttp = environmentContext.Environment.PreserveHttpEndpoints;\n\n        foreach (var resolved in resolvedEndpoints)\n        {\n            var endpoint = resolved.Endpoint;\n\n            if (!endpoint.IsExternal)\n            {\n                throw new NotSupportedException($\"The endpoint '{endpoint.Name}' on resource '{resource.Name}' is not external. App Service only supports external endpoints.\");\n            }\n\n            // By default, HTTP endpoints are upgraded to HTTPS in App Service\n            // If PreserveHttpEndpoints is true, keep the original scheme\n            var scheme = preserveHttp ? endpoint.UriScheme : \"https\";\n            var port = scheme is \"http\" ? 80 : 443;\n\n            // For App Service, we ignore port mappings since ports are handled by the platform\n            // TargetPort is null only for default ProjectResource endpoints (container port decides)\n            _endpointMapping[endpoint.Name] = new(\n                Scheme: scheme,\n                Host: HostName,\n                Port: port,\n                TargetPort: resolved.TargetPort,\n                IsHttpIngress: true,\n                External: true); // All App Service endpoints are external\n        }\n","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Azure.AppService/AzureAppServiceWebsiteContext.cs#L112-L148","documentation":"App Service publishing only models publicly reachable HTTP(S) sites, so ProcessEndpoints requires every endpoint on the resource to be external. If a resolved endpoint has IsExternal == false, this NotSupportedException is thrown naming the endpoint and resource.","triggerScenarios":"A project published to App Service contains an endpoint without WithExternalHttpEndpoints() (or declared as non-external), e.g. .WithHttpEndpoint(port: 8080, name: \"http\") with no external flag, and the AppService transformer processes it.","commonSituations":"Projects that mix internal-only and public endpoints; forgetting WithExternalHttpEndpoints after renaming endpoints; endpoints used solely for health checks or internal references.","solutions":["Add .WithExternalHttpEndpoints() to the project's HTTP endpoint(s).","Remove the non-external endpoint if it is not needed in the App Service deployment.","Set environment.PreserveHttpEndpoints/scheme configuration appropriately and mark the endpoint external when publishing to App Service."],"exampleFix":"// before\nvar api = builder.AddProject<Projects.Api>(\"api\").WithHttpEndpoint(port: 8080, name: \"http\");\n// after\nvar api = builder.AddProject<Projects.Api>(\"api\").WithHttpEndpoint(port: 8080, name: \"http\").WithExternalHttpEndpoints();","handlingStrategy":"validation","validationCode":"var nonExternal = project.Annotations.OfType<EndpointAnnotation>()\n    .Where(e => !e.IsExternal).ToList();\nif (nonExternal.Count > 0)\n    throw new NotSupportedException($\"All endpoints must be external for App Service: {string.Join(\", \", nonExternal.Select(e => e.Name))}\");","typeGuard":null,"tryCatchPattern":"try { await environmentContext.ProcessAsync(); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"is not external\"))\n{\n    logger.LogError(ex, \"Add WithExternalHttpEndpoints() to the project before publishing to App Service.\");\n    throw;\n}","preventionTips":["Always chain .WithExternalHttpEndpoints() on projects published to App Service.","Audit endpoints after renames/refactors to confirm the external flag survived.","Remove internal-only endpoints from App Service–targeted projects."],"tags":["azure-app-service","endpoint","external","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}