为ASP.NET Core与Worker提供Agent托管集成,支持服务化部署与运维。
Install
| Product | Versions |
|---|---|
| .NET | |
| Other |
README
NewLife.Agent - Cross-Platform Service Daemon & Ops Framework
🌐 简体中文 | 繁體中文 | Español | Deutsch | 日本語 | Français | Português | Русский | 한국어 | العربية
Tutorial: https://newlifex.com/core/agent
Overview
NewLife.Agent is a service-oriented framework for long-running applications. It enables console/Web/Worker programs to be quickly hosted as operating system services, and provides unified install, start/stop, monitoring, restart, and troubleshooting capabilities.
Supported platforms:
- Windows (Service / startup at login)
- Linux (Systemd / Procd / RcInit, etc.)
- macOS (LaunchAgent)
Supported frameworks:
NewLife.Agent:net40;net45;net461;netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0;net9.0;net10.0NewLife.Extensions.Hosting.AgentService:netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0;net10.0
Highlights
- Integrated Development and Operations: Inherit
ServiceBaseto gain full service governance capabilities. - Built-in Web Dashboard: A lightweight management panel for viewing status and performing operations in a browser, with extension panels and theme switching, built-in token authentication and brute-force protection; it listens on localhost by default (
WebBindcan expose it to the LAN). - Cross-Platform Auto-Adaptation: Automatically selects the most suitable host implementation per operating system.
- NativeAOT Native Publishing Support: Built-in commands and the Web dashboard are fully adapted for trimming/AOT;
net8.0+builds produce zeroIsAotCompatiblewarnings, and CI covers 12 RIDs: 9 targets run real smoke tests (8 native targets + linux-loongarch64 under QEMU user-mode emulation), while cross targets (linux-arm/linux-musl-arm/linux-musl-arm64) get publish verification. - Multi-Architecture Unit Tests: win-x64 / linux-x64 / linux-arm64 run natively, and linux-loongarch64 (Loongson) runs the full test suite under QEMU user-mode emulation; triggered by push/PR and supports manual runs.
- Built-in Command System: Supports
-install/-start/-stop/-restart/-status/-run. - Health Monitoring & Self-Healing: The HealthMonitor component provides memory/thread/handle thresholds, scheduled restarts, and WatchDog health checks.
- Multi-Instance Friendly: Configure different
ServiceNamevalues to deploy multiple instances of one program. - Host Integration Extension Package: Bring ASP.NET Core/Worker applications under unified service lifecycle management.
Getting Started
1) Minimal Service
Inherit ServiceBase and call Main(args) at the entry point:
- Override
StartWork(String reason)to start your business logic - Override
StopWork(String reason)to stop and clean up resources
2) Command-Line Operations
Common commands:
-i: Install the service-install: Install and start the service-start: Start the service-stop: Stop the service-restart: Restart the service-status: View service status-u: Uninstall the service-uninstall: Stop and uninstall the service-run: Run in console mode (for debugging)
Install/uninstall/start/stop typically require Administrator (Windows) or root (Linux) privileges.
3) ASP.NET Core / Worker Integration
Reference NewLife.Extensions.Hosting.AgentService and call UseAgentService() on your HostBuilder to bridge the generic host lifecycle with Agent service governance.
Documentation
- NewLife.Agent User & Ops Manual (Chinese)
- Requirements Document (Chinese)
- Feature List (Chinese)
- Architecture Design (Chinese)
- Competitive Analysis (Chinese)
- Changelog (Chinese)
- Changelog (English)
Quick Install
dotnet new install NewLife.Templates
dotnet new service --name agent
cd agent
dotnet run
Ecosystem Map
NewLife is a layered ecosystem of independently versioned open-source projects. The map below is shared verbatim by every NewLife repository; each project links to its repository and its primary NuGet package.
| Project | What it does | Downloads |
|---|---|---|
| Foundation | ||
| NewLife.Core | Logging, configuration, caching, networking, serialization, scheduling and APM tracing. | |
| NewLife.XCode | Data middleware: single tables at the tens-of-billions scale, automatic sharding, read-write splitting, 10+ databases. | |
| NewLife.Net | High-performance network library: 1.77M pps / 14.5 Gbps on a single machine (TCP 1KB, 2026-10), 4M long-lived TCP connections. | |
| NewLife.Remoting | Protocol communication and RPC framework for client/server applications and IoT devices. | |
| NewLife.Agent | Installs .NET applications as OS daemons: Windows services and Linux systemd. | |
| NewLife.Templates | dotnet new project templates for console, web, API, service, data and IoT projects. |
|
| Data & Messaging | ||
| NewLife.Redis | Redis client with microsecond latency, millions of ops/s and built-in message queues. | |
| NewLife.RocketMQ | Pure managed RocketMQ client for Apache RocketMQ and Alibaba Cloud Message Queue. | |
| NewLife.MQTT | MQTT client and server, including Alibaba Cloud IoT connectivity. | |
| NewLife.NovaDb | Hybrid database in C#: embedded or networked, relational, time-series, message queue and KV in one. | |
| NewLife.MySql | MySql driver and helper layer built on the NewLife data stack. | |
| Web, AI & Distributed | ||
| NewLife.Cube | Rapid admin-platform framework: permissions, SSO, OAuth server and CRUD scaffolding. | |
| Stardust | Distributed service platform: node management, APM, configuration center, registry and release center. | |
| AntJob | Distributed task and real-time data scheduling platform with sharding, retries and backfill. | |
| NewLife.AI | Unified client for 46 LLM providers plus ChatAI, a ready-to-run web chat application. | |
| Industrial & IoT | ||
| NewLife.IoT | IoT standard library defining protocol contracts and device abstractions. | |
| NewLife.Modbus | Modbus TCP/RTU/ASCII implementation on top of NewLife.IoT. | |
| NewLife.Siemens | Siemens PLC protocol on top of NewLife.IoT. | |
| NewLife.Omron | Omron PLC protocol on top of NewLife.IoT. | |
| NewLife.Melsec | Mitsubishi Melsec PLC protocol on top of NewLife.IoT. | |
| NewLife.OPC | OPC client for industrial data access. | — |
| NewLife.BACnet | BACnet building-automation protocol stack. | |
| ZeroIoT | Lightweight open-source IoT platform with gateway and device management. | — |
| Vehicle Telematics | ||
| NewLife.JT808 | JT/T 808 vehicle positioning protocol: 70+ message bodies, 2011/2013/2019. | |
| NewLife.JT809 | JT/T 809 platform-to-platform protocol for transport authorities. | |
| NewLife.JT1078 | JT/T 1078 in-vehicle video: RTP parsing, FLV/fMP4 remuxing and live streaming. | |
| Domain Components | ||
| NewLife.Office | One package for Excel, Word, PPT, PDF and 15+ document formats. | |
| NewLife.Audio | Cross-platform audio: codecs, device I/O, DSP, containers and streaming. | |
| NewLife.Video | Video codecs, container formats, frame processing and streaming. | |
| NewLife.Map | Unified interface over Baidu, AMap, Tencent and Tianditu with geocoding and coordinate conversion. | |
| NewLife.IP | IPv4 geolocation with an offline memory-mapped database and an online API fallback. | |
| Tools & Products | ||
| CrazyCoder | Developer toolbox: network, serial port, crypto, regex, Modbus and MQTT. | |
| GitCandy | Self-hosted Git source code management system. | — |
| LuckyClover | Installs the matching .NET runtime automatically when launched from an older host. | — |
Badges show the primary package of each project; theme, extension and satellite packages are listed on their NuGet pages.The 30+ packages not listed here (FTP, LoRa, Office extensions, protocol drivers and more) are available under the NewLifeX organization and on newlifex.com.
Team
Founded in 2002, the NewLife team has spent more than two decades on the .NET and IoT ecosystem, maintains nearly 100 open-source projects (34 of them core to this map), and delivers integrated software and hardware solutions for power, logistics, healthcare, industrial control and internet industries. We live by the motto "learning has no seniority — mastery earns respect".
Open-source components have been downloaded 6.48M times from NuGet (ecosystem-wide, as of 2026-10).
Website: https://newlifex.com · Open source organization: https://github.com/NewLifeX
WeChat Official Account: 智能大石头 (scan to follow)

Changes from Previous Version
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.