Linux CentOS创建webapi守护进程
创建文件:/etc/systemd/system/netcoreapi.service
以下是应用的一个示例服务文件:
[Unit] Description=MyWebAPI [Service] WorkingDirectory=/netcore/api ExecStart=/usr/bin/dotnet /netcore/api/webAPI.dll Restart=always # Restart service after 10 seconds if the dotnet service crashes: RestartSec=10 KillSignal=SIGINT SyslogIdentifier=dotnet-example User=root Environment=ASPNETCORE_ENVIRONMENT=Production Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false [Install] WantedBy=multi-user.target
systemctl enable netcorewebapi.service --启用服务
systemctl start netcorewebapi.service --启动服务
systemctl stop netcorewebapi.servicee --停止服务
systemctl status netcorewebapi.service --查看状态
journalctl -fu netcorewebapi.service --查看日志
                    
                
                
            
        
浙公网安备 33010602011771号