Stop a running dotnet core website running on kestrel

房东的猫 提交于 2019-12-05 00:31:26
Ilya Chumakov

Accordingly to this discussion, there is no safe way to stop Kestrel now. You need to find a PID by name of your dll and kill it:

kill $(ps aux | grep 'MySite.dll' | awk '{print $2}')

In case of process tree, you need to manually grep all child IDs and call kill for each. Like it was done in Microsoft.Extensions.Internal.ProcessExtensions.KillTree method (correct link from the discussion).

I have decided to use supervisor to monitor and manage the process. Here is an excellent article on getting it set up.

It allows simple control over specific dotnet apps like this:

supervisorctl stop MyWebsiteName
supervisorctl start MyWebsiteName

And it has one huge advantage in that it can try restart the process if it falls over, or when the system reboots... for whatever reason.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!