Zongsoft.Externals.Opc
1.0.0
dotnet add package Zongsoft.Externals.Opc --version 1.0.0
NuGet\Install-Package Zongsoft.Externals.Opc -Version 1.0.0
<PackageReference Include="Zongsoft.Externals.Opc" Version="1.0.0" />
<PackageVersion Include="Zongsoft.Externals.Opc" Version="1.0.0" />
<PackageReference Include="Zongsoft.Externals.Opc" />
paket add Zongsoft.Externals.Opc --version 1.0.0
#r "nuget: Zongsoft.Externals.Opc, 1.0.0"
#:package Zongsoft.Externals.Opc@1.0.0
#addin nuget:?package=Zongsoft.Externals.Opc&version=1.0.0
#tool nuget:?package=Zongsoft.Externals.Opc&version=1.0.0
Zongsoft.Externals.Opc Extension Plugin Library
Connection Settings (OpcConnectionSettings)
OpcConnectionSettings has no TOptions constraint and accepts arbitrary main parameter names. Server and its alias Url address the same parameter. OpcClient reads typed server, timeout, identity and security properties to establish a session, rather than generating SDK options through a generic GetOptions() step.
The raw dictionary exposes explicit parameters; typed reads supply defaults. Value retains all explicit main parameters and extension properties. Retaining an unknown entry does not mean the OPC client consumes it. See the Core settings contract for the complete rules.
Asynchronous Notifications and Lifetime
Use Subscriber.Consume(Func<Subscriber, Entry, object, CancellationToken, ValueTask>) for asynchronous notification handlers. Notifications are processed in order. SubscriberOptions.NotificationCapacity limits pending notifications and defaults to 2048; capacity overflow is reported by FlushAsync or DisposeAsync. The three-argument Consume(Action) overload is for local handlers that finish synchronously.
Await Subscriber.FlushAsync to finish accepted notifications and observe processing errors. Canceling the wait does not cancel accepted notifications. Use await using or await DisposeAsync for owned subscribers and OPC clients.
When using a Spooler, detach the consumer, await Subscriber.FlushAsync, then await Spooler.FlushAsync if buffered values must be processed before disposal. Spooler.DisposeAsync does not drain its buffer.
The adapter requires OPC Foundation SDK 2.0.1. Keep the SDK dependencies consistent within a host. Server authentication supports asynchronous validators; client connections require trusted server certificates. See the local client/server examples for setup.
Certificate Generation
If X509 certificates are used for authentication, use OpenSSL to generate the X509 certificate files.
💡 Note: adjust the command parameter values as needed.
Generate a Private Key
- Use the
openssl genpkeycommand to generate an unencrypted private key file.
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out certificate.private.pem -outform PEM
- Use the
openssl genpkeycommand to generate an encrypted private key file. Specify the password with the-passparameter.
openssl genpkey -algorithm RSA -aes256 -pkeyopt rsa_keygen_bits:2048 -out certificate.private.pem -outform PEM -pass pass:"password"
Create a Self-Signed Certificate
The -subj parameter contains these fields:
- CN = Common Name
- C = Country or region
- ST = State or province
- L = Locality or city
- O = Organization
- OU = Organizational unit or department
- Use the
openssl reqcommand to create a self-signed certificate with an unencrypted private key.
openssl req -new -x509 -key certificate.private.pem -days 3650 -out certificate.der -outform DER -subj "/C=CN/ST=Province|State/L=City/O=Organization/OU=Branch|Department/CN=Common Name/emailAddress=certificate@zongsoft.com"
- Use the
openssl reqcommand to create a self-signed certificate with an encrypted private key. Specify the private-key password with the-passinparameter.
openssl req -new -x509 -key certificate.private.pem -passin pass:"password" -days 3650 -out certificate.der -outform DER -subj "/C=CN/ST=Province|State/L=City/O=Organization/OU=Branch|Department/CN=Common Name/emailAddress=certificate@zongsoft.com"
Merge into a PKCS#12 File
- Use the
openssl pkcs12command to merge a certificate file without a password.Note: if the private key is encrypted, specify its password with the
-passinparameter.
openssl pkcs12 -inkey certificate.private.pem -in certificate.der -export -out certificate.pfx -passout pass:"" -name "FriendlyName"
openssl pkcs12 -inkey certificate.private.pem -passin pass:"password" -in certificate.der -export -out certificate.pfx -passout pass:"" -name "FriendlyName"
- Use the
openssl pkcs12command to merge a certificate file with a password. Specify the certificate-file password with the-passoutparameter.Note: if the private key is encrypted, specify its password with the
-passinparameter.
openssl pkcs12 -inkey certificate.private.pem -in certificate.der -export -out certificate.pfx -passout pass:"password" -name "FriendlyName"
openssl pkcs12 -inkey certificate.private.pem -passin pass:"password" -in certificate.der -export -out certificate.pfx -passout pass:"password" -name "FriendlyName"
OPC UA Server
To start an OPC UA server through plugins, deploy the optional daemon plugin and option selected by site=daemon. The main plugin only supplies the OPC client and server types; it does not start a listener by itself.
Server.Urls in the daemon option determines the actual service listener addresses and accepts multiple explicit opc.tcp URLs separated by commas. Server.Discovery is the registration target and controls server announcement separately; it is not a listener. The binding is generated from the same Urls value and preserves URL paths. Server.Enabled controls both startup and the declaration.
The binding declares OPC UA over TCP only. Certificates, trust stores, security policies and externally announced Endpoints remain part of OPC UA runtime configuration; the declaration does not imply HTTP health checks, proxying or NAT mapping.
Plugin-Based Integration
Compose this feature through the host; a package reference supplies compile-time APIs, while plugin loading also requires deployed manifests and runtime assets. See the complete plugin workflow.
The plugin makes the OPC adapter and SDK available. Application code configures endpoints, certificate trust and session/subscription lifetimes; no OPC connection is implied by copying the manifest.
| Runtime artifact | Source of truth |
|---|---|
Zongsoft.Externals.Opc |
Zongsoft.Externals.Opc.plugin |
| File copying and dependencies | Zongsoft.Externals.Opc.deploy |
Add this fragment to an existing host .deploy (retain Main and the host’s other base manifests; do not replace the whole file):
[plugins zongsoft externals opc]
nuget:Zongsoft.Externals.Opc
Run dotnet deploy against a test deployment as explained in the workflow, with the host's framework, platform, architecture and, where needed, site. Pin compatible versions in real deployments; application dependencies such as databases, caches or commercial runtimes are still separate prerequisites.
Additional artifacts listed by the deployment manifest include Zongsoft.Externals.Opc.plugin. Retain assemblies, dependencies and satellite resource directories as well. Restart the host after deployment, check plugin loading and service/driver registration, then verify the workflow above; copied files alone do not prove that the feature is active.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net11.0 is compatible. |
-
net10.0
- Microsoft.Extensions.Configuration (>= 10.0.15)
- Microsoft.Extensions.DependencyInjection (>= 10.0.15)
- Microsoft.Extensions.ObjectPool (>= 10.0.15)
- OPCFoundation.NetStandard.Opc.Ua (>= 2.0.1)
- OPCFoundation.NetStandard.Opc.Ua.Client (>= 2.0.1)
- OPCFoundation.NetStandard.Opc.Ua.Configuration (>= 2.0.1)
- OPCFoundation.NetStandard.Opc.Ua.Core (>= 2.0.1)
- OPCFoundation.NetStandard.Opc.Ua.Security.Certificates (>= 2.0.1)
- OPCFoundation.NetStandard.Opc.Ua.Server (>= 2.0.1)
- Zongsoft.Core (>= 7.79.0)
-
net11.0
- Microsoft.Extensions.Configuration (>= 11.0.0)
- Microsoft.Extensions.DependencyInjection (>= 11.0.0)
- Microsoft.Extensions.ObjectPool (>= 11.0.0)
- OPCFoundation.NetStandard.Opc.Ua (>= 2.0.1)
- OPCFoundation.NetStandard.Opc.Ua.Client (>= 2.0.1)
- OPCFoundation.NetStandard.Opc.Ua.Configuration (>= 2.0.1)
- OPCFoundation.NetStandard.Opc.Ua.Core (>= 2.0.1)
- OPCFoundation.NetStandard.Opc.Ua.Security.Certificates (>= 2.0.1)
- OPCFoundation.NetStandard.Opc.Ua.Server (>= 2.0.1)
- Zongsoft.Core (>= 7.79.0)
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 |
|---|---|---|
| 1.0.0 | 96 | 11/15/2026 |
| 0.28.0 | 120 | 10/20/2026 |
| 0.27.0 | 103 | 10/20/2026 |
| 0.26.0 | 91 | 10/17/2026 |
| 0.25.0 | 100 | 10/16/2026 |
| 0.24.0 | 105 | 10/10/2026 |
| 0.23.0 | 148 | 5/21/2026 |
| 0.22.0 | 139 | 3/16/2026 |
| 0.21.0 | 243 | 11/25/2025 |
| 0.20.0 | 256 | 10/28/2025 |
| 0.18.0 | 236 | 10/23/2025 |
| 0.17.0 | 265 | 9/4/2025 |
| 0.15.0 | 236 | 8/14/2025 |
| 0.14.0 | 235 | 7/14/2025 |
| 0.13.0 | 241 | 7/1/2025 |
| 0.12.0 | 235 | 6/26/2025 |
| 0.11.0 | 362 | 6/13/2025 |
| 0.10.0 | 388 | 6/12/2025 |