ZL.IotHub.Server 2.2.15

dotnet add package ZL.IotHub.Server --version 2.2.15
                    
NuGet\Install-Package ZL.IotHub.Server -Version 2.2.15
                    
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="ZL.IotHub.Server" Version="2.2.15" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZL.IotHub.Server" Version="2.2.15" />
                    
Directory.Packages.props
<PackageReference Include="ZL.IotHub.Server" />
                    
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 ZL.IotHub.Server --version 2.2.15
                    
#r "nuget: ZL.IotHub.Server, 2.2.15"
                    
#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 ZL.IotHub.Server@2.2.15
                    
#: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=ZL.IotHub.Server&version=2.2.15
                    
Install as a Cake Addin
#tool nuget:?package=ZL.IotHub.Server&version=2.2.15
                    
Install as a Cake Tool

ZL.IotHub.Server

通用 SCADA 实时网关:把 ZL.IotHub 采集内核的数据, 通过 SignalR(推送 + 命令)+ REST(查询 / 读写) 暴露给 Web / 桌面客户端。

协议无关——凡 ZL.IotHub 能驱动的设备(Siemens S7、Modbus、三菱、欧姆龙、AB、倍福、台达、基恩士…), 均可接入本网关做 SCADA 集成。

三步接入

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddZlScada(builder.Configuration);              // 1. 装配
var app = builder.Build();
ScadaDeviceProvisioner.ProvisionFromConfiguration(app.Configuration, app.Logger); // 2. 配置化注册设备
app.MapZlScada();                                                // 3. 映射端点
app.Run();

appsettings.json:

{
  "Urls": "http://localhost:5003",
  "Scada": {
    "Devices": [
      {
        "DeviceId": "PLC001",
        "Protocol": "siemens-s7",
        "Params": { "DeviceIp": "127.0.0.1", "Port": "102", "Rack": "0", "Slot": "1" },
        "Tags": [ { "Id": "MotorSpeed", "Address": "DB1.DBD14", "DataTypeCode": "int", "Length": 4, "AccessMode": "ReadWrite" } ]
      }
    ]
  }
}

默认端点

类型 路径
SignalR Hub /scadahub
健康检查 /health(含设备数/授权状态)
REST /api/devices、/api/tags/...、/api/devices/{id}/batch-read\|batch-write、/api/metrics

SignalR 事件:Snapshot、TagChanges、ConnectionStatus、DeviceStateChanged;方法:SendCommand、Subscribe。

读语义(重要)

  • REST 读(单点 + 批量)默认走设备本地缓存——后台采集引擎按扫描周期持续刷新 (值 + 质量码 + 时间戳),多客户端轮询不打 PLC 总线,也不与采集循环争抢设备锁。
  • ?live=true 强制读 PLC 总线:用于写后立即验证、设备未启动采集等场景 (写路径不更新缓存,写后到下次扫描之间缓存是旧值)。
  • 缓存为空但标签已注册 → quality="Initializing"(未知值不会被标成 Good)。
  • 写穿透:写成功后立即更新本地缓存——写后默认(缓存)读立即可见;下轮扫描读回校正(自愈)。
  • /health 返回 version(含提交号)与 uptimeSeconds,便于现场排障。
  • 未启用鉴权且绑定到非回环地址时,服务启动会输出安全警告(只警告不阻断)。

可组合映射(进阶)

app.MapZlScadaHub("/iot/hub");     // 只取 Hub(可自行加鉴权)
app.MapZlScadaRestApi("/iot");     // 自定义 REST 前缀
app.MapZlScadaHealth();

边界

  • 不含具体协议驱动(依赖 ZL.IotHub;HSL 商业协议需额外引用 ZL.IotHub.X);
  • 不含用户/鉴权体系(消费方自行接入);
  • 不含历史数据库。

详见仓库 docs/251(架构设计·权威参考)、docs/250(使用指南)、docs/252(读路径缓存优先化)、docs/249(架构审查)。

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

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.15 69 10/8/2026
2.2.14 72 10/6/2026