Ubuntu 16.04部署.NET Core APP 时出现code=exited, status=203/EXEC 1


我创建了一个ASP.NET MVC Core 应用,期望把它部署在Ubuntu 16.04。因为当前机器已经是LAMP环境了,所以我打算用Apache 来配置反向代理,使用
systemd 创建本地服务启动和管理Web应用。

微软的官方文档《使用 Apache 在 Linux 上托管 ASP.NET CoreHost ASP.NET Core on Linux with Apache》中使用的CentOS。我会列出在Ubuntu中配置的几个不同点。


Apache配置

Ubuntu 16.04 中的Apache2配置文件在,应该在/etc/apache2/sites-available/,而不是在/etc/httpd/conf.modules.d/ 。


Kestrel 配置

这是微软官网上的 Kestrel 的本地配置服务文件

[Unit]
Description=Example .NET Web API App running on CentOS 7
[Service]
WorkingDirectory=/var/www/helloapp
ExecStart=/usr/local/bin/dotnet /var/www/helloapp/helloapp.dll
Restart=always
Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-example
User=apache
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target

使用上面的配置,启动服务时,会遇到错误:(code=exited, status=203/EXEC),按照如下方式即可完美解决:

  • 修改ExecStart=/usr/local/bin/dotnet /var/www/helloapp/helloapp.dll 为: ExecStart=/usr/bin/dotnet /var/www/helloapp/helloapp.dll
  • 修改apache为www-data
本文链接: https://www.pstips.net/ubuntu-service-203-exec.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!

关于 Mooser Lee

我是一个Powershell的爱好者,创建了PowerShell中文博客,热衷于Powershell技术的搜集和分享。本站部分内容来源于互联网,不足之处敬请谅解,并欢迎您批评指正。

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注

一条评论 “Ubuntu 16.04部署.NET Core APP 时出现code=exited, status=203/EXEC

  • 高上地

    您好,之前您的一篇导出水滴筹捐款名单的文章给了我很大的启发。但自己没有这方面的知识,不知道能不能请您帮我导出下,可以付费。
    我想感谢那些帮助我的人,但几万人,我一个个点,不太可能。想着通过抓取网页信息来做。但没有这方面知识。
    如有打扰,非常抱歉。
    感谢您!