本文介绍了停止在 kestrel 上运行的正在运行的 dotnet 核心网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

部署现有 .net 核心网站的新版本时.我如何首先安全停止正在运行的旧 Kestrel 应用程序?

When deploying a new version of an existing .net core website. How do I first safely stop the old running kestrel app?

这是我想写的例子(伪部署脚本):

Here is an exmaple of what I would like to write (Pseudo deployment script):

dotnet stop mysite/mysite.dll <---- this line here
mv mysite/ mysite.bak/
cp newly-published-mysite/ mysite/
dotnet run mysite/mysite.dll

killall dotnet 似乎有点不安全.如果我在一个盒子上托管两个小网站,它会如何工作?

killall dotnet seems a little unsafe. How would it work if I were hosting two small sites on one box?

推荐答案

我决定使用 supervisor 来监控和管理流程.这是一篇关于如何设置它的优秀文章.

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

它允许像这样简单地控制特定的 dotnet 应用程序:

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.

这篇关于停止在 kestrel 上运行的正在运行的 dotnet 核心网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 15:42