我正在尝试将xsp4作为systemd服务运行,以便在Ubuntu 16.04上托管WebAPI 2应用程序。这是我的服务文件:
[Unit]
Description=myapp xsp4 WebAPI 2
Wants=network.target
[Service]
Type=simple
User=www-data
Group=www-data
EnvironmentFile=/etc/myapp/env
ExecStart=/usr/bin/xsp4 --appconfigdir /etc/xsp4/ --root /var/www/myapp.com/server --address 127.0.0.1
Restart=on-failure
[Install]
WantedBy=multi-user.target
ExecStart
中的命令在shell(以root身份)运行时运行正常。当我从systemd开始时,我得到:
root@ubuntu-512mb-ams3-01:/etc/systemd/system# sctl status myapp.service
● myapp.service - myapp xsp4 WebAPI 2
Loaded: loaded (/etc/systemd/system/myapp.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Oct 07 14:32:00 ubuntu-512mb-ams3-01 systemd[1]: myapp.service: Start request repeated too quickly.
Oct 07 14:32:00 ubuntu-512mb-ams3-01 systemd[1]: Failed to start myapp xsp4 WebAPI 2.
Oct 07 14:59:12 ubuntu-512mb-ams3-01 systemd[1]: Stopped myapp xsp4 WebAPI 2.
Oct 07 14:59:16 ubuntu-512mb-ams3-01 systemd[1]: Started myapp xsp4 WebAPI 2.
Oct 07 14:59:19 ubuntu-512mb-ams3-01 xsp4[26490]: xsp4
Oct 07 14:59:19 ubuntu-512mb-ams3-01 xsp4[26490]: Listening on address: 127.0.0.1
Oct 07 14:59:19 ubuntu-512mb-ams3-01 xsp4[26490]: Root directory: /var/www/myapp.com/server
Oct 07 14:59:19 ubuntu-512mb-ams3-01 xsp4[26490]: Listening on port: 9000 (non-secure)
Oct 07 14:59:19 ubuntu-512mb-ams3-01 xsp4[26490]: Hit Return to stop the server.
Oct 07 14:59:19 ubuntu-512mb-ams3-01 xsp4[26490]: [0x7f24851e9700:] EXCEPTION handling: System.Threading.ThreadAbortException:
在shell中运行时,不会发生 System.Threading.ThreadAbortException 。实际错误是"启动请求重复得太快。"因为我配置了mono来输出所有异常,即使被捕获 - 所以这个异常不是退出的原因。
有什么建议吗?
答案 0 :(得分:0)
我将添加答案,因为我自己正在寻找。
[服务]
TimeoutStartSec = 100
ExecStart = / usr / bin / xsp4 --appconfigdir / etc / xsp4 / --root /var/www/myapp.com/server --address 127.0.0.1-不间断 >