NewLife.Extensions.Hosting.AgentService 10.15.2026.402

dotnet add package NewLife.Extensions.Hosting.AgentService --version 10.15.2026.402
                    
NuGet\Install-Package NewLife.Extensions.Hosting.AgentService -Version 10.15.2026.402
                    
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.Extensions.Hosting.AgentService" Version="10.15.2026.402" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NewLife.Extensions.Hosting.AgentService" Version="10.15.2026.402" />
                    
Directory.Packages.props
<PackageReference Include="NewLife.Extensions.Hosting.AgentService" />
                    
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.Extensions.Hosting.AgentService --version 10.15.2026.402
                    
#r "nuget: NewLife.Extensions.Hosting.AgentService, 10.15.2026.402"
                    
#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.Extensions.Hosting.AgentService@10.15.2026.402
                    
#: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.Extensions.Hosting.AgentService&version=10.15.2026.402
                    
Install as a Cake Addin
#tool nuget:?package=NewLife.Extensions.Hosting.AgentService&version=10.15.2026.402
                    
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 是一个面向长期运行应用的服务化框架,支持将控制台/Web/Worker 程序快速托管为系统服务,并统一提供安装、启停、监控、重启与排障能力。

支持平台:

  • Windows(服务 / 登录自启动)
  • Linux(Systemd / Procd / RcInit 等)
  • macOS(LaunchAgent)

支持框架:

  • NewLife.Agentnet40;net45;net461;netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0;net9.0;net10.0
  • NewLife.Extensions.Hosting.AgentServicenetcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0

亮点

  • 开发与运维一体化:继承 ServiceBase 即可获得服务治理能力。
  • 跨平台自动适配:按系统自动选择最合适宿主实现。
  • 内置命令体系:支持 -install/-start/-stop/-restart/-status/-run
  • 健康监控与自愈:内存/线程/句柄阈值、定时重启、WatchDog。
  • 多实例友好:通过配置不同 ServiceName 可一程序多实例部署。
  • Host 集成扩展包:可将 ASP.NET Core/Worker 纳入统一服务生命周期管理。

主要使用方式

1)最小服务程序

继承 ServiceBase,在入口调用 Main(args)

  • 重写 StartWork(String reason) 启动业务
  • 重写 StopWork(String reason) 停止业务并清理资源

2)命令行运维

常用命令:

  • -install:安装服务
  • -start:启动服务
  • -stop:停止服务
  • -restart:重启服务
  • -status:查看状态
  • -uninstall:卸载服务
  • -run:控制台模拟运行(调试)

安装/卸载/启停通常需要管理员(Windows)或 root(Linux)权限。

3)ASP.NET Core / Worker 集成

引用 NewLife.Extensions.Hosting.AgentService,在 HostBuilder 调用 UseAgentService(),即可将通用主机生命周期与 Agent 服务治理能力打通。


详细文档


快速拥有

dotnet new install NewLife.Templates
dotnet new service --name agent
cd agent
dotnet run

新生命项目矩阵

各项目默认支持net9.0/netstandard2.1/netstandard2.0/net4.62/net4.5,旧版(2024.0801)支持net4.0/net2.0

项目 年份 说明
基础组件 支撑其它中间件以及产品项目
NewLife.Core 2002 核心库,日志、配置、缓存、网络、序列化、APM性能追踪
NewLife.XCode 2005 大数据中间件,单表百亿级,MySql/SQLite/SqlServer/Oracle/PostgreSql/达梦,自动分表,读写分离
NewLife.Net 2005 网络库,单机千万级吞吐率(2266万tps),单机百万级连接(400万Tcp长连接)
NewLife.Remoting 2011 协议通信库,提供CS应用通信框架,支持Http/RPC通信框架,高吞吐,物联网设备低开销易接入
NewLife.Cube 2010 魔方快速开发平台,集成了用户权限、SSO登录、OAuth服务端等,单表100亿级项目验证
NewLife.Agent 2008 服务管理组件,把应用安装成为操作系统守护进程,Windows服务、Linux的Systemd
NewLife.Zero 2020 Zero零代脚手架,基于NewLife组件生态的项目模板NewLife.Templates,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标准库实现,支持ZeroIoT平台和IoTEdge网关
NewLife.Siemens 2022 西门子PLC协议,基于IoT标准库实现,支持IoT平台和IoTEdge
NewLife.Map 2022 地图组件库,封装百度地图、高德地图、腾讯地图、天地图
NewLife.Audio 2023 音频编解码库,PCM/ADPCMA/G711A/G722U/WAV/AAC
产品平台 产品平台级,编译部署即用,个性化自定义
Stardust 2018 星尘,分布式服务平台,节点管理、APM监控中心、配置中心、注册中心、发布中心
AntJob 2019 蚂蚁调度,分布式大数据计算平台(实时/离线),蚂蚁搬家分片思想,万亿级数据量项目验证
NewLife.ERP 2021 企业ERP,产品管理、客户管理、销售管理、供应商管理
CrazyCoder 2006 码神工具,众多开发者工具,网络、串口、加解密、正则表达式、Modbus、MQTT
EasyIO 2023 简易文件存储,支持分布式系统中文件集中存储。
XProxy 2005 产品级反向代理,NAT代理、Http代理
HttpMeter 2022 Http压力测试工具
GitCandy 2015 Git源代码管理系统
SmartOS 2014 嵌入式操作系统,完全独立自主,支持ARM Cortex-M芯片架构
SmartA2 2019 嵌入式工业计算机,物联网边缘网关,高性能.NET8主机,应用于工业、农业、交通、医疗
FIoT物联网平台 2020 物联网整体解决方案,建筑、环保、农业,软硬件及大数据分析一体化,单机十万级点位项目验证
UWB高精度室内定位 2020 厘米级(10~20cm)高精度室内定位,软硬件一体化,与其它系统联动,大型展厅项目验证

新生命开发团队

XCode

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

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

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

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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 is compatible.  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 is compatible.  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 netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NewLife.Extensions.Hosting.AgentService:

Package Downloads
sljc_WebApi.Core

用于后台API服务包

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.15.2026.402 60 4/2/2026
10.15.2026.402-beta0903 57 4/2/2026
10.15.2026.313-beta1445 87 3/13/2026
10.15.2026.305-beta0001 81 3/5/2026
10.15.2026.201 128 2/1/2026
10.15.2026.201-beta0225 97 2/1/2026
10.14.2026.112-beta0712 102 1/12/2026
10.14.2026.102 134 1/2/2026
10.14.2026.102-beta1552 104 1/2/2026
10.14.2025.1113 329 11/13/2025
10.14.2025.1113-beta0106 307 11/13/2025
10.13.2025.1001 242 10/1/2025
10.13.2025.1001-beta1728 218 10/1/2025
10.13.2025.901 263 9/1/2025
10.13.2025.901-beta0240 213 9/1/2025
10.13.2025.824-beta1223 232 8/24/2025
10.13.2025.604 341 6/4/2025
10.13.2025.602-beta1643 204 6/2/2025
10.12.2025.401 437 4/1/2025
10.12.2025.401-beta0712 216 4/1/2025
Loading failed

支持Web、WebApi和Worker等现代化项目