NewLife.Agent 10.9.2024.621-beta0040

This is a prerelease version of NewLife.Agent.
There is a newer version of this package available.
See the version list below for details.
dotnet add package NewLife.Agent --version 10.9.2024.621-beta0040
                    
NuGet\Install-Package NewLife.Agent -Version 10.9.2024.621-beta0040
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NewLife.Agent" Version="10.9.2024.621-beta0040" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NewLife.Agent" Version="10.9.2024.621-beta0040" />
                    
Directory.Packages.props
<PackageReference Include="NewLife.Agent" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NewLife.Agent --version 10.9.2024.621-beta0040
                    
#r "nuget: NewLife.Agent, 10.9.2024.621-beta0040"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NewLife.Agent@10.9.2024.621-beta0040
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NewLife.Agent&version=10.9.2024.621-beta0040&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=NewLife.Agent&version=10.9.2024.621-beta0040&prerelease
                    
Install as a Cake Tool

NewLife.Agent - 守护服务管理组件

GitHub top language GitHub License Nuget Downloads Nuget Nuget (with prereleases) Nuget Downloads Nuget Nuget (with prereleases)

使用教程:https://newlifex.com/core/agent

功能特点

NewLife.Agent是一个服务管理框架,用于开发随系统自动启动的长时间运行后台应用程序,支持Windows/Linux。
在Windows上注册为Windows服务,在Linux上注册为Systemd守护进程。
Agent支持netstandard2.0/net45/net40/mono,旧版本还支持net20(已不再维护)。
源码库:https://github.com/NewLifeX/NewLife.Agent

Agent常用于各种后台应用,如aspnetcore应用、RPC网络服务器、MQTT服务器、数据处理应用、数据消费应用(Redis/RocketMQ)等。同类软件有 NSSM、srvany,但并不一样,Agent是框架,而它们是具体软件,更像星尘代理 StarAgent。

NewLife.Agent主要功能:

  1. 注册应用为系统服务或守护进程,随系统自动启动
  2. 支持控制台菜单控制安装、卸载、启动、停止,以及查看状态
  3. 支持控制台调试应用,解决Windows服务难以调试的问题
  4. 支持健康检测,限制内存、线程数、句柄数,超限时重启应用服务
  5. 支持应用服务定时重启,通过配置指定
  6. 支持看门狗WatchDog,通过配置指定要守护的目标应用服务,如果目标停止则启动
  7. 支持配置文件修改服务名,一个应用程序可在多个目录上部署为不同的系统服务

服务控制

一个服务代理示例跑起来的样子
image.png
image.png
这是Agent的标准控制台(Windows和Centos)。上面是该服务的状态信息,下面是控制菜单。
示例分析:

  • 服务名 XAgent/StarAgent,可以命令启动停止,Windows是net start XAgent/net stop XAgent,Linux是systemctl start StarAgent/systemctl stop StarAgent
  • 显示名“新生命服务代理”是在windows服务控制板里面看到的名字
  • 下一段信息给出了NewLife.Agent和当前应用的版本信息和编译时间
  • 黄色菜单可通过按键选择相应操作,内置012345,可自定义其它按键操作
  • 菜单1,显示状态,按下1后刷新状态信息
  • 菜单2,安装服务或卸载服务,安装成功后,显示信息变为卸载服务,反之亦然
  • 菜单3,启动服务或停止服务,安装后才可以看见
  • 菜单4,重启服务,安装且运行后可以看见
  • 菜单5,模拟运行,在当前进程启动应用主逻辑,用于业务逻辑调试,等同于Windows服务调用
  • 菜单0,退出应用服务

!!!注意,服务安装、卸载、启动、停止,在Windows/Linux上需要管理员权限运行

服务应用在Windows上以本地用户权限运行,有最高权限;
服务应用在Linux上以root权限运行,有最高权限;
该设计尽管带来了一定安全风险,但能够避免绝大部分初级用户的简单问题,优先易用性。

新生命项目矩阵

各项目默认支持net8.0/net7.0/netstandard2.1/netstandard2.0/net4.61,旧版(2022.1225)支持net4.5/net4.0/net2.0

项目 年份 说明
基础组件 支撑其它中间件以及产品项目
NewLife.Core 2002 核心库,日志、配置、缓存、网络、序列化、APM性能追踪
NewLife.XCode 2005 大数据中间件,单表百亿级,MySql/SQLite/SqlServer/Oracle/TDengine/达梦,自动分表
NewLife.Net 2005 网络库,单机千万级吞吐率(2266万tps),单机百万级连接(400万Tcp)
NewLife.Remoting 2011 RPC通信框架,内网高吞吐或物联网硬件设备场景
NewLife.Cube 2010 魔方快速开发平台,集成了用户权限、SSO登录、OAuth服务端等,单表100亿级项目验证
NewLife.Agent 2008 服务管理组件,把应用安装成为操作系统守护进程,Windows服务、Linux的Systemd
NewLife.Zero 2020 Zero零代脚手架,基于NewLife组件生态的项目模板,Web、WebApi、Service
中间件 对接知名中间件平台
NewLife.Redis 2017 Redis客户端,微秒级延迟,百万级吞吐,丰富的消息队列,百亿级数据量项目验证
NewLife.RocketMQ 2018 RocketMQ纯托管客户端,支持Apache RocketMQ和阿里云消息队列,十亿级项目验
NewLife.MQTT 2019 物联网消息协议,MqttClient/MqttServer,客户端支持阿里云物联网
NewLife.IoT 2022 IoT标准库,定义物联网领域的各种通信协议标准规范
NewLife.Modbus 2022 ModbusTcp/ModbusRTU/ModbusASCII,基于IoT标准库实现,支持IoT平台和IoTEdge
NewLife.Siemens 2022 西门子PLC协议,基于IoT标准库实现,支持IoT平台和IoTEdge
NewLife.Map 2022 地图组件库,封装百度地图、高德地图和腾讯地图
NewLife.IP 2022 IP地址库,IP地址转物理地址
产品平台 产品平台级,编译部署即用,个性化自定义
AntJob 2019 蚂蚁调度,分布式大数据计算平台(实时/离线),蚂蚁搬家分片思想,万亿级数据量项目验证
Stardust 2018 星尘,分布式服务平台,节点管理、APM监控中心、配置中心、注册中心、发布中心
NewLife.ERP 2021 企业ERP,产品管理、客户管理、销售管理、供应商管理
CrazyCoder 2006 码神工具,众多开发者工具,网络、串口、加解密、正则表达式、Modbus
XProxy 2005 产品级反向代理,NAT代理、Http代理
HttpMeter 2022 Http压力测试工具
GitCandy 2015 Git源代码管理系统
SmartOS 2014 嵌入式操作系统,完全独立自主,支持ARM Cortex-M芯片架构
SmartA2 2019 嵌入式工业计算机,物联网边缘网关,高性能.NET6主机,应用于工业、农业、交通、医疗
菲凡物联FIoT 2020 物联网整体解决方案,建筑、环保、农业,软硬件及大数据分析一体化,单机十万级点位项目验证
NewLife.UWB 2020 厘米级(10~20cm)高精度室内定位,软硬件一体化,与其它系统联动,大型展厅项目验证

新生命开发团队

XCode

新生命团队(NewLife)成立于2002年,是新时代物联网行业解决方案提供者,致力于提供软硬件应用方案咨询、系统架构规划与开发服务。
团队主导的开源NewLife系列组件已被广泛应用于各行业,Nuget累计下载量高达60余万次。
团队开发的大数据核心组件NewLife.XCode、蚂蚁调度计算平台AntJob、星尘分布式平台Stardust、缓存队列组件NewLife.Redis以及物联网平台NewLife.IoT,均成功应用于电力、高校、互联网、电信、交通、物流、工控、医疗、文博等行业,为客户提供了大量先进、可靠、安全、高质量、易扩展的产品和系统集成服务。

我们将不断通过服务的持续改进,成为客户长期信赖的合作伙伴,通过不断的创新和发展,成为国内优秀的IT服务供应商。

新生命团队始于2002年,部分开源项目具有20年以上漫长历史,源码库保留有2010年以来所有修改记录
网站:https://newlifex.com
开源:https://github.com/newlifex
QQ群:1600800/1600838
微信公众号:
智能大石头

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on NewLife.Agent:

Package Downloads
NewLife.Extensions.Hosting.AgentService

应用程序注册为系统服务,支持Windows/Linux

sljc_WebApi.Core

用于后台API服务包

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on NewLife.Agent:

Repository Stars
NewLifeX/Stardust
星尘,轻量级分布式服务框架。配置中心、集群管理、远程自动发布、服务治理。服务自动注册和发现,负载均衡,动态伸缩,故障转移,性能监控。
NewLifeX/NewLife.Net
单机吞吐2266万tps的网络通信框架
NewLifeX/XProxy
XProxy是一个代理服务器,内置有NAT、反向代理、直接代理、间接代理等。
Version Downloads Last Updated
10.13.2025.901 212 9/1/2025
10.13.2025.901-beta0240 134 9/1/2025
10.13.2025.824-beta1223 177 8/24/2025
10.13.2025.604 423 6/4/2025
10.13.2025.602-beta1643 150 6/2/2025
10.12.2025.401 643 4/1/2025
10.12.2025.401-beta0712 178 4/1/2025
10.12.2025.329-beta1223 121 3/29/2025
10.11.2025.311-beta0002 180 3/11/2025
10.11.2025.201 435 2/1/2025
10.11.2025.201-beta1619 119 2/1/2025
10.11.2025.109-beta1236 167 1/9/2025
10.11.2025.101 295 1/1/2025
10.10.2024.1225-beta1450 149 12/25/2024
10.10.2024.1224-beta0713 110 12/24/2024
10.10.2024.1223 235 12/23/2024
10.10.2024.1202 299 12/2/2024
10.10.2024.1129-beta0118 125 11/29/2024
10.10.2024.1116 283 11/16/2024
10.9.2024.902 542 9/2/2024
10.9.2024.801 394 8/1/2024
10.9.2024.801-beta0700 128 8/1/2024
10.9.2024.728-beta1649 125 7/28/2024
10.9.2024.701 399 7/1/2024
10.9.2024.701-beta1516 133 7/1/2024
10.9.2024.629-beta0804 149 6/29/2024
10.9.2024.626-beta1734 137 6/26/2024
10.9.2024.626-beta1613 133 6/26/2024
10.9.2024.624-beta1712 161 6/24/2024
10.9.2024.624-beta0623 131 6/24/2024
10.9.2024.621-beta0040 146 6/21/2024
10.9.2024.620-beta0006 150 6/20/2024
10.9.2024.619-beta0922 146 6/19/2024
10.9.2024.609-beta1644 137 6/9/2024
10.9.2024.609-beta1438 125 6/9/2024
10.9.2024.602-beta1628 152 6/2/2024
10.9.2024.601 288 6/1/2024
10.9.2024.601-beta0355 130 6/1/2024
10.8.2024.529-beta1039 146 5/29/2024
10.8.2024.527-beta0909 139 5/27/2024
10.8.2024.527-beta0743 133 5/27/2024
10.8.2024.526-beta1649 140 5/26/2024
10.8.2024.526-beta1557 144 5/26/2024
10.8.2024.526-beta1549 152 5/26/2024
10.8.2024.521-beta0014 212 5/21/2024
10.8.2024.520-beta0606 153 5/20/2024
10.8.2024.519-beta0654 150 5/19/2024
10.8.2024.518-beta1641 139 5/18/2024
10.8.2024.518-beta1617 145 5/18/2024
10.7.2024.518-beta1030 138 5/18/2024
10.7.2024.515 236 5/15/2024
10.7.2024.515-beta0213 172 5/15/2024
10.7.2024.423-beta0032 192 4/23/2024
10.7.2024.402 407 4/2/2024
10.7.2024.402-beta1636 139 4/2/2024
10.7.2024.331-beta0602 136 3/31/2024
10.7.2024.330-beta0952 143 3/30/2024
10.7.2024.320-beta1230 156 3/20/2024
10.7.2024.303 241 3/3/2024
10.7.2024.303-beta1433 132 3/3/2024
10.6.2024.228-beta1451 132 2/28/2024
10.6.2024.203 255 2/3/2024
10.6.2024.203-beta0307 138 2/3/2024
10.6.2024.101 406 1/1/2024
10.6.2024.101-beta0504 161 1/1/2024
10.6.2023.1224-beta1607 179 12/24/2023
10.6.2023.1212-beta0405 163 12/12/2023
10.6.2023.1210-beta1341 152 12/10/2023
10.6.2023.1201 328 12/1/2023
10.6.2023.1201-beta0552 145 12/1/2023
10.6.2023.1128-beta0010 153 11/28/2023
10.6.2023.1120-beta0220 165 11/20/2023
10.6.2023.1102 362 11/2/2023
10.6.2023.1102-beta0640 113 11/2/2023
10.6.2023.1016-beta1607 172 10/16/2023
10.6.2023.1001 358 10/1/2023
10.5.2023.927-beta1518 134 9/27/2023
10.5.2023.912-beta1050 169 9/12/2023
10.5.2023.910-beta0910 181 9/10/2023
10.5.2023.909-beta0003 162 9/9/2023
10.5.2023.812-beta0824 243 8/12/2023
10.5.2023.801 618 8/1/2023
10.5.2023.801-beta0306 191 8/1/2023
10.4.2023.801-beta0301 191 8/1/2023
10.4.2023.729-beta0002 199 7/29/2023
10.4.2023.725-beta0222 189 7/25/2023
10.4.2023.601 706 6/1/2023
10.4.2023.601-beta1428 194 6/1/2023
10.4.2023.512-beta1512 275 5/12/2023
10.4.2023.505 448 5/5/2023
10.4.2023.505-beta1611 214 5/5/2023
10.4.2023.504-beta0114 213 5/4/2023
10.4.2023.416-beta1214 232 4/16/2023
10.4.2023.401 563 4/1/2023
10.4.2023.401-beta1724 202 4/1/2023
10.4.2023.331-beta0844 212 3/31/2023
10.3.2023.318-beta0213 228 3/18/2023
10.3.2023.301 575 3/1/2023
10.3.2023.301-beta0447 224 3/1/2023
10.2.2023.218-beta0229 253 2/18/2023
10.2.2023.214-beta1542 242 2/14/2023
10.2.2023.214-beta0206 217 2/14/2023
10.2.2023.203 699 2/3/2023
10.2.2023.203-beta1429 225 2/3/2023
10.2.2023.101-beta1647 219 1/1/2023
10.1.2023.101 714 1/1/2023
10.1.2023.101-beta0227 227 1/1/2023
10.1.2022.1225-beta1424 259 12/25/2022
10.1.2022.1221-beta1657 214 12/21/2022
10.1.2022.1220-beta0114 229 12/20/2022
10.1.2022.1217-beta0142 218 12/17/2022
10.1.2022.1201 822 12/1/2022
10.1.2022.1201-beta1238 213 12/1/2022
10.0.2022.1201-beta0631 213 12/1/2022
10.0.2022.1108-beta0052 275 11/8/2022
10.0.2022.1106-beta0431 258 11/6/2022
10.0.2022.1104 757 11/4/2022
10.0.2022.1104-beta0629 226 11/4/2022
10.0.2022.1003 908 10/3/2022
10.0.2022.1003-beta1306 217 10/3/2022
10.0.2022.1003-beta1216 221 10/3/2022
9.4.2022.1003 507 10/3/2022
9.4.2022.1003-beta1215 203 10/3/2022
9.4.2022.1003-beta1149 188 10/3/2022
9.4.2022.1003-beta0057 197 10/3/2022
9.3.2022.901 915 9/1/2022
9.3.2022.901-beta0350 196 9/1/2022
9.3.2022.822-beta1114 220 8/22/2022
9.3.2022.814-beta0223 244 8/14/2022
9.3.2022.810-beta1048 214 8/10/2022
9.2.2022.701 939 7/1/2022
9.2.2022.701-beta1340 232 7/1/2022
9.1.2022.622-beta1235 255 6/22/2022
9.1.2022.501 1,042 5/1/2022
9.1.2022.501-beta0208 243 5/1/2022
9.0.2022.406 686 4/6/2022
9.0.2022.406-beta1209 218 4/6/2022
9.0.2022.320-beta1415 300 3/20/2022
9.0.2022.315-beta0816 241 3/15/2022
9.0.2022.312-beta1041 237 3/12/2022
9.0.2022.101 1,058 1/1/2022
8.8.2021.1204 982 12/4/2021
8.8.2021.1109 682 11/9/2021
8.7.2021.1001 704 10/1/2021
8.7.2021.708 1,177 7/8/2021
8.7.2021.204 1,392 2/4/2021
8.7.2021.101 964 1/1/2021
8.7.2020.1201 796 12/1/2020
8.7.2020.1101 916 11/1/2020
8.7.2020.1002 891 10/3/2020
8.7.2020.918-beta3 499 9/18/2020
8.7.2020.914-beta 442 9/14/2020
8.7.2020.912-beta 494 9/12/2020
8.7.2020.802 1,121 8/2/2020
8.7.2020.718-beta 543 7/17/2020
8.7.2020.601 1,071 5/31/2020
8.7.2020.525-rc 469 5/25/2020
8.7.2020.510-beta 477 5/10/2020
8.7.2020.501 819 5/1/2020
8.7.2020.421-beta2 496 4/21/2020
8.7.2020.403 876 4/2/2020
8.7.2020.329-beta 505 3/29/2020
8.7.2020.322-beta 534 3/22/2020
8.6.2020.204 893 2/4/2020
8.5.2020.101 874 1/1/2020
8.4.2019.1212 864 12/12/2019
8.4.2019.1203 741 12/3/2019
8.4.2019.1109 1,008 11/9/2019
8.3.2019.923 839 9/24/2019
8.3.2019.822 946 8/22/2019
8.2.2019.706 1,270 7/6/2019
8.1.2019.618 803 6/23/2019
8.1.2019.602 820 6/2/2019
8.1.2019.510 825 5/10/2019
8.1.2019.406 803 4/6/2019
8.1.2019.320 804 3/20/2019
8.1.2019.310 859 3/10/2019
8.0.2019.101 1,130 1/1/2019

重构菜单架构;增强Systemd支持更多参数设置