[英]Running K Kestrel in the background
How does one run the Kestrel webserver in a persistent way on Linux / OSX? 如何在Linux / OSX上以持久的方式运行Kestrel Web服务器? I am able to run the webserver as expected with:
我可以通过以下方式按预期方式运行网络服务器:
k kestrel 红k
However, I have not found a way to background it for persistence, ie 但是,我还没有找到将其持久化的背景,即
k kestrel & k
The process starts then immediately stops. 该过程开始,然后立即停止。
Just try to use 只是尝试使用
nohup k kestrel &
Tested with CentOS 7 (64 bit) 经过CentOS 7(64位)的测试
Works as expected :) 按预期工作:)
For centos7 you can create systemd wrapper: 对于centos7,您可以创建systemd包装器:
File /etc/systemd/system/kestrel-test.service
: 文件
/etc/systemd/system/kestrel-test.service
:
[Unit]
Description=Web .Net Application running on Centos
[Service]
WorkingDirectory=/www/site.tld/htdocs
ExecStart=/usr/bin/dotnet /www/site.tld/htdocs/bin/Debug/netcoreapp2.0/asp.net.dll
Restart=always
RestartSec=10
SyslogIdentifier=dotnet-example
User=aspnetcoreuser
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
Then, you can manage it via sudo service kestrel-test start
(stop, status). 然后,您可以通过
sudo service kestrel-test start
(停止,状态)来管理它。
Also it works for other systemd OS like Ubuntu16. 它也适用于其他系统操作系统,例如Ubuntu16。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.