Error starting userland proxy: Bind for 0.0.0.0:50496: unexpected error Permission denied

I tried create a supported docker project by Visual Studio 2019 and run it, but I got this error

1>WebApplication1 -> D:\Test Repo\WebApplication1\bin\Debug\netcoreapp2.2\WebApplication1.dll
1>docker run -dt -v “C:\Users\vtn\vsdbg\vs2017u5:/remote_debugger:rw” -v “D:\Test Repo\WebApplication1:/app” -v “C:\Users\vtn\AppData\Roaming\ASP.NET\Https:/root/.aspnet/https:ro” -v “C:\Users\vtn\AppData\Roaming\Microsoft\UserSecrets:/root/.microsoft/usersecrets:ro” -v “C:\Users\vtn.nuget\packages:/root/.nuget/fallbackpackages2” -v “C:\Program Files\dotnet\sdk\NuGetFallbackFolder:/root/.nuget/fallbackpackages” -e “DOTNET_USE_POLLING_FILE_WATCHER=1” -e “ASPNETCORE_ENVIRONMENT=Development” -e “ASPNETCORE_URLS=https://+:443;http://+:80” -e “ASPNETCORE_HTTPS_PORT=44331” -e “NUGET_PACKAGES=/root/.nuget/fallbackpackages2” -e “NUGET_FALLBACK_PACKAGES=/root/.nuget/fallbackpackages;/root/.nuget/fallbackpackages2” -p 50496:80 -p 44331:443 --entrypoint tail webapplication1:dev -f /dev/null
1>ef277d41ad1802503aa128566263a1dca7b1df0c09677ae102c026b78eb6eb00
1>docker: Error response from daemon: driver failed programming external connectivity on endpoint wizardly_shaw (870d627a99e6e8877e8f7fca633fe3125e6a7892f6254d6ed817755c19729410): Error starting userland proxy: Bind for 0.0.0.0:50496: unexpected error Permission denied.
1>C:\Users\vtn.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.4.10\build\Container.targets(258,5): error CTP1002: An error occurred while attempting to run Docker container.
1>Done building project “WebApplication1.csproj” – FAILED.

I tried to find the process using port 50496 (0.0.0.0:50496), but this port was not used by any process.

Hope you guys can help me solve it.

Thanks for reading!

Cheers!

Try mapping to a port >49152. That’s where the dynamic port range starts, and for some reason I’ve seen errors trying to -p into those high ranges.