{"record":{"id":"ac123f76c2fcb31b","repo":"dotnet/orleans","slug":"orleans-advertisedipaddress-must-contain-the-conta","errorCode":null,"errorMessage":"Orleans:AdvertisedIPAddress must contain the Container Apps environment private IP.","messagePattern":"Orleans:AdvertisedIPAddress must contain the Container Apps environment private IP\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"samples/Deployment/AzureContainerApps/Infrastructure/OrleansEndpointConfigurationExtensions.cs","lineNumber":26,"sourceCode":"\npublic static class OrleansEndpointConfigurationExtensions\n{\n    public static ISiloBuilder ConfigureSampleEndpoints(\n        this ISiloBuilder siloBuilder,\n        IConfiguration configuration,\n        IHostEnvironment environment,\n        int developmentSiloPort,\n        int developmentGatewayPort)\n    {\n        var advertisedIpValue = configuration[\"Orleans:AdvertisedIPAddress\"];\n        if (environment.IsDevelopment() && string.IsNullOrWhiteSpace(advertisedIpValue))\n        {\n            return siloBuilder.ConfigureEndpoints(developmentSiloPort, developmentGatewayPort);\n        }\n\n        if (!IPAddress.TryParse(advertisedIpValue, out var advertisedIp))\n        {\n            throw new InvalidOperationException(\n                \"Orleans:AdvertisedIPAddress must contain the Container Apps environment private IP.\");\n        }\n\n        var advertisedSiloPort = GetRequiredPort(configuration, \"Orleans:AdvertisedSiloPort\");\n        var advertisedGatewayPort = GetRequiredPort(configuration, \"Orleans:AdvertisedGatewayPort\");\n\n        return siloBuilder.Configure<EndpointOptions>(options =>\n        {\n            options.AdvertisedIPAddress = advertisedIp;\n            options.SiloPort = advertisedSiloPort;\n            options.GatewayPort = advertisedGatewayPort;\n            options.SiloListeningEndpoint = new IPEndPoint(IPAddress.Any, 11_111);\n            options.GatewayListeningEndpoint = new IPEndPoint(IPAddress.Any, 30_000);\n        });\n    }\n\n    private static int GetRequiredPort(IConfiguration configuration, string key)\n    {","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/samples/Deployment/AzureContainerApps/Infrastructure/OrleansEndpointConfigurationExtensions.cs#L8-L44","documentation":"An InvalidOperationException thrown by ConfigureOrleansEndpoints when Orleans:AdvertisedIPAddress is present (so the dev shortcut is skipped) but cannot be parsed as an IP address by IPAddress.TryParse. In Azure Container Apps the silo must advertise the environment's private IP; a malformed value would cause cluster-membership failure, so it is rejected at startup.","triggerScenarios":"The host is not Development (or AdvertisedIPAddress is set) and the configured value is not a parseable IP (e.g., a hostname, 'localhost', empty after dev check, or a typo). IPAddress.TryParse returns false.","commonSituations":"Setting a DNS hostname instead of an IP. Using 'localhost' in a container app. A placeholder like '<private-ip>' left in the config. Missing the variable so the value is null.","solutions":["Set Orleans:AdvertisedIPAddress to the container app's private IP (an IPv4/IPv6 literal).","If you used a hostname, resolve it to an IP first (the code expects a literal, not a name).","For local dev, leave it unset so the IsDevelopment branch configures endpoints automatically."],"exampleFix":"// before (config)\n\"Orleans\": { \"AdvertisedIPAddress\": \"my-silo.contoso.com\" }\n\n// after\n\"Orleans\": { \"AdvertisedIPAddress\": \"10.0.0.12\" }","handlingStrategy":"validation","validationCode":"var ip = configuration[\"Orleans:AdvertisedIPAddress\"];\nif (!IPAddress.TryParse(ip, out _))\n    throw new InvalidOperationException(\"Orleans:AdvertisedIPAddress must be an IP literal (the Container Apps private IP).\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set Orleans:AdvertisedIPAddress to an IP literal (IPv4/IPv6), never a hostname.","For local dev, leave it unset so the dev branch auto-configures endpoints.","Resolve hostnames to IPs in your deployment script before injecting the value."],"tags":["orleans","configuration","networking","azure-container-apps","validation","startup"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}