Skip to content

SocketException permission denied when trying to bind port 80 or 443 to Kestrel in Azure Container Instance with .NET 8 #53015

Answered by Piedone
Piedone asked this question in Q&A
Discussion options

You must be logged in to vote

Found the solution. It was actually setting ContainerUser with <ContainerUser>root</ContainerUser> in the csproj. No other changes necessary.

So, all in all, compared to the .NET 6 version, my app has the following changes to target .NET 8:

  • <TargetFramework>net8.0</TargetFramework> in the csproj.
  • <TargetFramework>net8.0</TargetFramework> in the pubxml used by az container create.
  • <ContainerUser>root</ContainerUser> in the csproj, see below the context.

Full section of the csproj:

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <UserSecretsId>MyId</UserSecretsId>
    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
    <NoDefaultLaunchSettingsFile>true</NoDefaultL…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@Piedone
Comment options

@elruss
Comment options

@Piedone
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Piedone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants