简体   繁体   English

“service ... start”指令对于 .NET Core 应用程序究竟意味着什么?

[英]What exactly does a 'service ... start' instruction mean for a .NET Core application?

I need to deploy a .NET Core app (that uses an MVC pattern) that's already been configured to run on an Ubuntu VM that's running under Azure.我需要部署一个已配置为在 Azure 下运行的 Ubuntu VM 上运行的 .NET Core 应用程序(使用 MVC 模式)。 NGINX appears to be in use as a reverse proxy server. NGINX 似乎用作反向代理服务器。 I have a set of instructions for deployment, where the final step is to run this instruction on an Ubuntu terminal:我有一组部署说明,其中最后一步是在 Ubuntu 终端上运行此说明:

service myservicename start

What exactly is this instruction doing and where is it documented?该指令究竟是做什么的,它在哪里记录? Is it part of the .NET CLI, or something to do with NGINX or Linux?它是 .NET CLI 的一部分,还是与 NGINX 或 Linux 有关? And can I derive anything from the use of this instruction as to what form the application is running in?我能否从使用此指令中得出有关应用程序以何种形式运行的任何信息? For example does it infer that the app is running as some type of Linux service?例如,它是否推断该应用程序正在作为某种类型的 Linux 服务运行?

I figured out that the .NET app is running under the Linux systemd "System and Service Manager", and the command is to start the app under that service manager.我发现 .NET 应用程序在 Linux systemd “系统和服务管理器”下运行,命令是在该服务管理器下启动应用程序。

If I run systemctl status myservicename it shows me a description of the service, and its main details, including the location of the user-created service file for the app.如果我运行systemctl status myservicename它会向我显示服务的描述及其主要详细信息,包括用户为应用程序创建的服务文件的位置。 The service can then be examined using the following from a Linux terminal:然后可以从 Linux 终端使用以下命令检查该服务:

cat [serviceFileLocation]

(eg serviceFileLocation might be /etc/systemd/system/myservicename.service ) (例如serviceFileLocation可能是/etc/systemd/system/myservicename.service

The content of the service file then reveals that the main service command ExecStart is configured to run the application .dll via the dotnet core runtime:服务文件的内容显示主服务命令ExecStart被配置为通过 dotnet 核心运行时运行应用程序 .dll:

在此处输入图片说明

Here's a useful startup guide for .NET Core running under systemd这是在 systemd 下运行的 .NET Core的有用启动指南

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM