Search code examples
asp.netazure-aks.net-8.0

HTTP_PORTS when running ASP.NET 8 container in AKS


In the logs of a ASP.NET 8 container I find this entry

[22:38:50 WRN] Overriding HTTP_PORTS '8080' and HTTPS_PORTS ''. Binding to values defined by URLS instead 'http://+:80'. # {"EventId": {"Id": 15}, "SourceContext": "Microsoft.AspNetCore.Hosting.Diagnostics"}

I do not understand where that HTTP_PORTS settings comes from, as none of the configuration sources I can think of set it.


Solution

  • This setup comes from the original images ans it can be viewed when inspecting the image, as the sample below:

    "Env": [
                "DOTNET_USE_POLLING_FILE_WATCHER=1",
                "ASPNETCORE_ENVIRONMENT=Development",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "APP_UID=1654",
                "ASPNETCORE_HTTP_PORTS=8080",
                "DOTNET_RUNNING_IN_CONTAINER=true",
                "DOTNET_VERSION=8.0.0-rc.2.23479.6",
                "ASPNET_VERSION=8.0.0-rc.2.23480.2",
                "ASPNETCORE_URLS=http://+:5099"
            ], 
    

    To avoid this warning you can set the environment variable ASPNETCORE_HTTP_PORTS, and comment the "ENV ASPNETCORE_URLS" line in your Dockerfile file and re-create the image again.

    #ENV ASPNETCORE_URLS=http://+:5099
    ENV ASPNETCORE_HTTP_PORTS=5099
    

    I hope it helps you.