Top Related Projects
Open source implementation of OPC UA (OPC Unified Architecture) aka IEC 62541 licensed under Mozilla Public License v2.0
Unlocking the Full Potential of OPC UA with Typescript and NodeJS - http://node-opcua.github.io/
Quick Overview
The UA-.NETStandard repository is an official implementation of the OPC Unified Architecture (OPC UA) standard for .NET Standard. It provides a comprehensive set of libraries and tools for developing OPC UA clients and servers in .NET environments, supporting various platforms and frameworks.
Pros
- Cross-platform compatibility due to .NET Standard implementation
- Comprehensive support for OPC UA features and specifications
- Active development and maintenance by the OPC Foundation
- Extensive documentation and sample applications
Cons
- Steep learning curve for newcomers to OPC UA
- Complex architecture may be overwhelming for simple use cases
- Limited support for older .NET Framework versions
- Performance overhead compared to native implementations
Code Examples
- Creating an OPC UA client and connecting to a server:
using Opc.Ua;
using Opc.Ua.Client;
var config = new ApplicationConfiguration()
{
ApplicationName = "MyClient",
ApplicationUri = "urn:MyClient",
ApplicationType = ApplicationType.Client,
SecurityConfiguration = new SecurityConfiguration { AutoAcceptUntrustedCertificates = true },
TransportConfigurations = new TransportConfigurationCollection(),
TransportQuotas = new TransportQuotas { OperationTimeout = 15000 },
ClientConfiguration = new ClientConfiguration { DefaultSessionTimeout = 60000 }
};
await config.Validate(ApplicationType.Client);
var application = new ApplicationInstance(config);
await application.CheckApplicationInstanceCertificate(false, 0);
using (var session = await Session.Create(config, new ConfiguredEndpoint(null, new EndpointDescription("opc.tcp://localhost:4840")), false, "", 60000, null, null))
{
// Use the session to interact with the server
}
- Reading a value from an OPC UA server:
NodeId nodeId = new NodeId("ns=2;s=MyVariable");
DataValue value = await session.ReadValueAsync(nodeId);
Console.WriteLine($"Value: {value.Value}, StatusCode: {value.StatusCode}");
- Writing a value to an OPC UA server:
NodeId nodeId = new NodeId("ns=2;s=MyVariable");
DataValue newValue = new DataValue(new Variant(42));
StatusCode result = await session.WriteValueAsync(nodeId, newValue);
Console.WriteLine($"Write result: {result}");
Getting Started
-
Install the NuGet package:
dotnet add package OPCFoundation.NetStandard.Opc.Ua -
Create a new console application and add the following using statements:
using Opc.Ua; using Opc.Ua.Client; -
Implement a basic OPC UA client as shown in the first code example above.
-
Run your application and connect to an OPC UA server.
Competitor Comparisons
Open source implementation of OPC UA (OPC Unified Architecture) aka IEC 62541 licensed under Mozilla Public License v2.0
Pros of open62541
- Written in C, offering better performance and lower resource usage
- Highly portable, suitable for embedded systems and various platforms
- More flexible and customizable due to its low-level implementation
Cons of open62541
- Steeper learning curve, especially for developers not familiar with C
- Less extensive documentation compared to UA-.NETStandard
- Smaller community and ecosystem compared to the .NET-based alternative
Code Comparison
UA-.NETStandard (C#):
var application = new ApplicationInstance {
ApplicationName = "MyOPCUAClient",
ApplicationType = ApplicationType.Client
};
await application.CheckApplicationInstanceCertificate(false, 2048);
open62541 (C):
UA_Client *client = UA_Client_new();
UA_ClientConfig_setDefault(UA_Client_getConfig(client));
UA_StatusCode retval = UA_Client_connect(client, "opc.tcp://localhost:4840");
if(retval != UA_STATUSCODE_GOOD) {
UA_Client_delete(client);
return (int)retval;
}
The code snippets demonstrate the initialization of a client application in both libraries. UA-.NETStandard offers a more high-level, object-oriented approach, while open62541 provides a lower-level C implementation, requiring more manual setup but offering finer control over the process.
Unlocking the Full Potential of OPC UA with Typescript and NodeJS - http://node-opcua.github.io/
Pros of node-opcua
- Written in JavaScript, making it easier for web developers to integrate
- Supports both client and server implementations
- Active community and frequent updates
Cons of node-opcua
- May have performance limitations compared to native implementations
- Less comprehensive documentation and examples
- Smaller ecosystem of tools and extensions
Code Comparison
UA-.NETStandard (C#):
var endpointUrl = "opc.tcp://localhost:4840";
var client = new OpcUaClient();
await client.ConnectAsync(endpointUrl);
var node = client.Session.NodeCache.Find(ObjectIds.Server_ServerStatus_CurrentTime);
var value = await node.ReadValueAsync();
node-opcua (JavaScript):
const client = OPCUAClient.create();
await client.connect("opc.tcp://localhost:4840");
const session = await client.createSession();
const node = "ns=0;i=2258";
const dataValue = await session.read({nodeId: node});
Both repositories provide implementations of the OPC UA protocol, but they target different languages and ecosystems. UA-.NETStandard is the official .NET implementation, offering robust performance and comprehensive features. node-opcua, on the other hand, brings OPC UA to the JavaScript world, making it accessible to a wider range of developers, especially those working on web-based applications. While UA-.NETStandard may have an edge in terms of performance and completeness, node-opcua offers flexibility and ease of integration for JavaScript developers.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
OPC UA .NET Stack
Overview
This OPC UA reference implementation targets .NET Framework, .NET, and .NET Standard 2.1.
.NET allows to develop apps that run on all common platforms available today, including Linux, iOS, Android (via Xamarin) and Windows without requiring platform-specific modifications.
One of the reference implementations inside this project has been certified for compliance through an OPC Foundation Certification Test Lab to prove its high quality. Fixes and enhancements since the certification process have been tested and verified for compliance using the latest Compliance Test Tool (CTT).
For a comprehensive list of supported OPC UA Profiles and Facets, see the dedicated documentation.
More samples based on the official Nuget packages can be found in the OPC UA .NET Samples repository. For development there is also a preview Nuget feed available. For local testing a Docker container of the Reference Server is available for preview and release builds.
Features included
Core and Libraries
- Fully ported Core OPC UA Stack and Libraries (Client, Server, Configuration, Complex Types & GDS assemblies).
- Reference sample Server and Client.
- X.509 Certificate support for client and server authentication.
- SHA-2 support (up to SHA512) including security profile Basic256Sha256, Aes128Sha256RsaOaep and Aes256Sha256RsaPss for configurations with high security needs.
- ECC Security policies ECC_nistP256, ECC_nistP384, ECC_brainpoolP256r1 and ECC_brainpoolP384r1.
- Anonymous, username and X.509 certificate user authentication.
- UA-TCP & HTTPS transports (client and server).
- Reverse Connect for the UA-TCP transport (client and server).
- Folder & OS-level (X509Store) Certificate Stores with Global Discovery Server and Server Push support.
- Sessions and (durable) Subscriptions.
- A PubSub library with samples.
Key Features and Updates in OPC UA 1.05
- Security Enhancements: Improved encryption and authentication mechanisms.
- CRL Support: Added Certificate Revocation List support for X509Store on Windows.
- Performance Improvements: Faster binary encoding and decoding, reducing memory usage and latency.
- Role-Based Management: Support for WellKnownRoles and RoleBasedUserManagement WellKnownRoles & RoleBasedUserManagement.
- Improved Logging: Enhanced logging with
ILoggerandEventSource. - ECC Profiles: Support for NIST & Brainpool Security Profiles.
- Durable Subscriptions: Support for Durable Subscriptions Durable Subscriptions.
Breaking Changes and Heads-Up when upgrading from 1.04 to 1.05
- A few features are still missing to fully comply for 1.05, but certification for V1.04 is still possible with the 1.05 release.
- Thread Safety and Locking: Improved thread safety and reduced locking in secure channel operations.
- Audit and Redaction: New interfaces for auditing and redacting sensitive information.
New in 1.05.378.
- Support for AsyncNodeManagers in the Server Library, see Server Async (TAP) Support
- Reworked Observability via
ITelemetryContextin preparation for better DI support. See documentation for breaking changes.
New in 1.05.376.
- Support for Durable Subscriptions
New in 1.05.375
- Support for ECC Certificates.
New in 1.05.374.70
- CRL Support for the X509Store on Windows
New in 1.05.373
- 1.05 Nodeset
- Support for WellKnownRoles & RoleBasedUserManagement.
New in 1.04.368
- Improved support for Logging with
ILoggerandEventSource. - Support for custom certificate stores with refactored
ICertificateStoreandCertificateStoreTypeinterface. - Client and Server support for TransferSubscriptions.
- How to use Container support with reference server.
Samples and Nuget packages
- OPC UA Console Reference Server for .NET. A Linux Container of the latest builds is available. See also Container support.
- The OPC UA Reference Server has been certified for compliance through an OPC Foundation Certification Test Lab. Fixes and enhancements since the certification process have been tested and verified for compliance using the Compliance Test Tool (CTT). All releases are verified for compliance with the latest official Compliance Test Tool by the maintainers.
- OPC UA Console Reference Publisher and Console Reference Subscriber for .NET and .NET Framework.
- An official OPC UA Nuget package of the core, client, server and configuration libraries is available for integration in .NET projects. Note: The package has been split into Core, Client and Server packages to reduce the dependencies in projects where only client or server is needed. The https binding is now a seperate optional package.
- A preview Nuget feed is available from Azure Devops.
Getting Started
All the tools you need to build .NET libraries and application come with the .NET SDK. You need the .net 10 SDK to build the project. To run applications you need one of the target .NET runtimes installed. See Get started with .NET for what you need.
How to build and run the reference samples in Visual Studio on Windows
- Open the
UA.slnxsolution file using Visual Studio 2026. Ensure you have all target frameworks enabled, including .NET 4.8.x, .NET 8.0, 9.0, and 10.0 (LTS) but Visual Studio will prompt you to install what is missing. - Choose a project in the Solution Explorer and set it with a right click as
Startup Project. - Hit
F5to build and execute the sample.
How to build and run the console samples on Windows, Linux and iOS
This section describes how to run the ConsoleReferenceServer sample application.
Please follow instructions in this article to setup the .NET 10 SDK which provides the dotnet command that allows you to build and run the samples on your platform. Once the dotnet command is available, navigate to the root folder in your local copy of the repository and execute dotnet restore 'UA.slnx'. This command calls into NuGet to restore the tree of dependencies.
Start the server
- Open a command prompt.
- Navigate to the folder Applications/ConsoleReferenceServer.
- To run the server sample type
dotnet run --project ConsoleReferenceServer.csproj -a.- The server is now running and waiting for connections.
Contributing
We strongly encourage community participation and contribution to this project. First, please fork the repository and commit your changes there. Once happy with your changes you can generate a 'pull request'.
You must agree to the contributor license agreement (CLA) before we can accept your changes. The CLA and "I AGREE" button is automatically displayed when you perform the pull request.
Remarks
Self signed certificates for the sample applications
All required application certificates for OPC UA are created at the first start of each application in a directory or OS-level certificate store and remain in use until deleted from the store. Please read Certificates for more information about certificates and stores
Local Discovery Server
By default all sample applications are configured to register with a Local Discovery Server (LDS). A reference implementation of a LDS for Windows can be downloaded here. To setup trust with the LDS the certificates need to be exchanged or registration will fail.
Top Related Projects
Open source implementation of OPC UA (OPC Unified Architecture) aka IEC 62541 licensed under Mozilla Public License v2.0
Unlocking the Full Potential of OPC UA with Typescript and NodeJS - http://node-opcua.github.io/
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot