C# DotNetCore Development: Manually Stopping the Kestrel Server

Find Tips and tricks on how to better use the Zeus IDE. Feel free to post your own tips but please do not post bug reports, feature requests or questions here.
Post Reply
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

C# DotNetCore Development: Manually Stopping the Kestrel Server

Post by jussij »

When developing for DotNetCore you'll be running a local server or service on a specific local port number, for example port 52895.

Sometimes when trying to restart your server/service you'll see this error message:
System.IO.IOException: Failed to bind to address http://127.0.0.1:52895: address already in use.
This means is a previous debug session is still running and that process is locking the 52895 port and hence the reason the start debug request fails.

NOTE: Depending on your particular debug setup that 52895 port will vary.

An easy way to fix this is to kill each an every DotNet process using this command in a PowerShell command prompt:

Code: Select all

Get-Process -Name *dotnet* | Stop-Process
IMPORTANT: Before running any command from the internet make sure you understand what these commands do. In this case the command is killing all dotnet process which is perfectly acceptable for a development machine running, however running this command in a production environment would be totally acceptable.

Cheers Jussi
Post Reply