Unable to start Kestrel. System.Net.Sockets.SocketException (13): Permission denied

7/5/2020
Back to List

Problem

When running a ASP.NET Core application as a non-root user, Kestrel fails to bind to port 80 and 443.

Unable to start Kestrel. System.Net.Sockets.SocketException (13): Permission denied

Solution

To allow the app to bind to privelaged ports between 1 and 1023 run the following command, adjusting the path to the binary.

sudo setcap CAP_NET_BIND_SERVICE=+eip /path/to/binary

SuperChad
Gravatar About Sean Nelson
I like codes and stuff.

0 comments