How-to guide
Set up the license
Set up the license in a client or server application: evaluation, entering the license key, querying the license, and checking it at startup.
How-to guide
Set up the license
This page shows how to set up the license of the OPC UA .NET SDK in your client or server application. The page Licenses describes the available license models and SDK variants and how to handle the license key.
Types usedOpc.UaFx.LicenserOpc.UaFx.Client.LicenserOpc.UaFx.Server.LicenserILicenseInfo
Evaluation
Without a license key, you can evaluate the SDK free of charge and without time limit: the trial license runs for 30 minutes per application start, during which the SDK is available without restriction for client and server development. If 30 minutes per application start are not enough for you, you can request an extended evaluation from us. To do so, contact our support at support@traeger.de. Our development team is also happy to advise you directly and answer open questions.
Enter the license key
Once you have received your personalized license key, enter it in the SDK. The class that takes the key depends on the SDK variant:
| License | Class | Enter before first accessing |
|---|---|---|
| Client license | Opc. | OpcClient |
| Server license | Opc. | OpcServer |
| Bundle license (client and server) | Opc. | OpcClient or OpcServer |
Add the matching line of code to your application before you access the class OpcClient or OpcServer for the first time. Replace <insert your license code here> with the license key you received from us.
Client license
Opc.UaFx.Client.Licenser.LicenseKey = "<insert your license code here>";Opc.UaFx.Client.Licenser.LicenseKey = "<insert your license code here>"Server license
Opc.UaFx.Server.Licenser.LicenseKey = "<insert your license code here>";Opc.UaFx.Server.Licenser.LicenseKey = "<insert your license code here>"Bundle license
If you have purchased a bundle license key for client and server development from us, enter it like this:
Opc.UaFx.Licenser.LicenseKey = "<insert your license code here>";Opc.UaFx.Licenser.LicenseKey = "<insert your license code here>"Once set, a bundle license key takes precedence over the client or server license key. If a bundle license key is set, the SDK checks the license against this key only. A client or server license key set in addition is then ignored.
Query the license in use
The LicenseInfo property returns information about the license that the SDK currently uses. For client licenses, query it through the class Opc.UaFx.Client.Licenser, for server licenses through the class Opc.UaFx.Server.Licenser, and for bundle licenses through the class Opc.UaFx.Licenser. To query the license:
ILicenseInfo license = Opc.UaFx.Client.Licenser.LicenseInfo;
if (license.IsExpired)
Console.WriteLine("The OPC UA SDK license is expired!");ILicenseInfo license = Opc.UaFx.Server.Licenser.LicenseInfo;
if (license.IsExpired)
Console.WriteLine("The OPC UA SDK license is expired!");Dim license As ILicenseInfo = Opc.UaFx.Client.Licenser.LicenseInfo
If license.IsExpired Then
Console.WriteLine("The OPC UA SDK license is expired!")
End IfDim license As ILicenseInfo = Opc.UaFx.Server.Licenser.LicenseInfo
If license.IsExpired Then
Console.WriteLine("The OPC UA SDK license is expired!")
End IfCheck the license at startup
During development and evaluation, it often does not matter whether the SDK still runs in evaluation mode or already with the purchased license. In production, however, an invalid license causes the application to stop working while it runs. We therefore recommend that you add the following code snippet to the application and run it at least when the application starts. The methods whose names begin with FailIf take effect only in debug builds (symbol DEBUG). The methods with ThrowIf take effect in all builds. Besides ThrowIfUnlicensed, ThrowIfEvaluation, ThrowIfExpired, and ThrowIfSupportExpired are also available:
#if DEBUG
Opc.UaFx.Client.Licenser.FailIfUnlicensed();
#else
Opc.UaFx.Client.Licenser.ThrowIfUnlicensed();
#endif#if DEBUG
Opc.UaFx.Server.Licenser.FailIfUnlicensed();
#else
Opc.UaFx.Server.Licenser.ThrowIfUnlicensed();
#endif#If DEBUG Then
Opc.UaFx.Client.Licenser.FailIfUnlicensed()
#Else
Opc.UaFx.Client.Licenser.ThrowIfUnlicensed()
#End If#If DEBUG Then
Opc.UaFx.Server.Licenser.FailIfUnlicensed()
#Else
Opc.UaFx.Server.Licenser.ThrowIfUnlicensed()
#End IfFor more information on licensing, purchasing, and other questions, see our product page OPC UA SDKs.

