Older question, but here's how we are working around it.
From a clean start, using $ dotnet run
will create a single instance of Kestrel, so it's easy to attach to from Visual Studio.
However, running$ dotnet build && dotnet run
will create an instance of the build server AND an instance of Kestrel. Now it's harder to know what dotnet
process to attach to. Further, running this command multiple times can create additional processes.
Our solution was to use $ dotnet build && dotnet build-server shutdown && dotnet run
. This stops the build server after the build, so now there's only one dotnet
process to attach to.
There might be additional solutions at some point here: https://github.com/dotnet/cli/issues/9481