Far*_*ood 2 ubuntu kestrel asp.net-core
我在 /etc/systemd/system 中创建一个服务,如下所示:
$ cd /etc/systemd/system
$ sudo nano test.service
Run Code Online (Sandbox Code Playgroud)
添加以下内容
[Unit]
Description=test app
[Service]
WorkingDirectory=/var/www/test-app
ExecStart=/usr/bin/dotnet /var/www/test-app/Test.App.dll
Restart=always
RestartSec=10
SyslogIdentifier=test
User=ubuntu
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
保存服务后运行以下命令
$ sudo systemctl enable test.service
$ sudo systemctl start test.service
$ sudo systemctl status test.service
Run Code Online (Sandbox Code Playgroud)
但显示此错误
test.service - test app
Loaded: loaded (/etc/systemd/system/test.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sat 2020-02-15 10:41:19 UTC; 8s ago
Process: 24631 ExecStart=/usr/bin/dotnet /var/www/test-app/Test.App.dll (code=exited, status=200/CHDIR)
Main PID: 24631 (code=exited, status=200/CHDIR)
Run Code Online (Sandbox Code Playgroud)
用户 (ubuntu) 存在并且拥有应用程序文件的适当所有权
归档时间: |
|
查看次数: |
8866 次 |
最近记录: |