With the Managed Resource License Store, you embed your license key into one of the assemblies that your application comprises of.
The main advantage of this method is that it does not require any additional actions during deployment. Also, because the Managed Resource License is the first one in the search order, you have a guarantee that if you properly place a specific valid license key into the managed resource license store, it will be the one actually used - it cannot be changed by License Manager, for example. The disadvantage of this method is that you need to put extra code and data into your application, before building it.
Follow the steps below in order to place a license into the Managed Resource License Store and use it. The procedure is written for C# in Visual Studio, but should be similar with other managed languages and tools.
The available registration methods differ as follows:
The license key registration call must be made before any QuickOPC, OPC Wizard or Rapid Toolkit for Sparkplug operation is performed, or before you attempt to retrieve the license info.
Note that the actual validity of the license key is not checked at the time when the location is registered.
The proper determining of the managed resource namespace, and precise typing of license key file name is a common source of errors (see Troubleshooting further below). In order to alleviate such problems, you can use a resource name pattern instead of the precise resource name. The pattern uses syntax similar to the Visual Basic LIKE operator. Most importantly, you can use the asterisk ('*') widcard to represent any sequence of characters. For example, instead of passing "MyApp.Resource.Key-Permanent-ShareIt-1912345678-20180612.txt" to the RegisterManagedResource Method or the RegisterManagedResourceWithExistenceCheck Method as the resource name, pass the recommended pattern "*.Key-*.*" instead. This pattern specifies that a manage resource should be located whose full name starts with any sequence of characters (and therefore it can be in any namespace), contains "Key-" followed by any sequence of characters, and has any extension.
The specified pattern must not match more than one managed resource in the assembly, otherwise an error occurs.
The disadvantage of using the name pattern is a (slight) risk that other managed resources that happen to match the specified pattern will be found, but since you are normally in control of what managed resources go into your project, the risk can easily be mitigated.
Examples - QuickOPC
The example below shows how to register a license located in an embedded managed resource.
The example below shows how to register a license located in an embedded managed resource.
Examples - OPC Wizard
Example: Examples - Server Licensing - Register managed resource
Example: Examples - Server Licensing - Register managed resource and verify existence
Examples - Rapid Toolkit for Sparkplug
If you use the RegisterManagedResource Method and the registration is not done properly, the component will continue the search for the license key in the order described in Licensing Elements. Usually, you will end up with a trial license instead, which is manifested by receiving a serial number other than the serial number of the license key you attempted to register. The serial number of stock demo or trial license is between 1111110000 and 1111119999 - see
Examples - Client Licensing - Obtain serial numberIf you use the RegisterManagedResourceWithExistenceCheck Method and the registration is not done properly, an exception is thrown.
Here are the common reasons that can cause these issues:
If you cannot rule out that the cause is in incorrect resource namespace (or resource name, in general), we recommend to use the ILDASM tool (IL Disassembler, https://docs.microsoft.com/en-us/dotnet/framework/tools/ildasm-exe-il-disassembler ) to figure out the precise actual name of your license key managed resource. You can use following steps:
For illustration, the part of the MANIFEST with the license key for our example looks like this:
.mresource public 'UADocExamples.Licensing.Key-DemoOrTrial-WebForm-1999003494-20180611.bin'
{
// Offset: 0x00000000 Length: 0x00000A68
}
You will also end up with a trial license if the managed resource registration is made correctly, but the license key is not valid for some reason - for example, it does not apply to the version of the software you are runing.
Sparkplug is a trademark of Eclipse Foundation, Inc. "MQTT" is a trademark of the OASIS Open standards consortium. Other related terms are trademarks of their respective owners. Any use of these terms on this site is for descriptive purposes only and does not imply any sponsorship, endorsement or affiliation.