Protect a service
Overview
If your application runs as a service, say a Windows Service, you can protect your application with QLM as follows:
In your service startup code, add license validation when the service starts. If you are using the LicenseValidator class generated by the "Protect your application" wizard, call ValidateLicenseAtStartup when your service starts. If the call to ValidateLicenseAtStart up fails, you have two options:
Log an event in the Event Viewer with the error message returned by ValdiateLicenseAtStartup. The user would then need to launch the QLM License Wizard standalone application (with the proper arguments) to allow him/her to enter a license key.
Launch the QLM License Wizard standalone application (with the proper arguments) to allow the user to enter his license key. This may not be possible if your service does not have the privileges to launch a desktop app.
Configuration
If the service is running with the credentials of the Local System Account, you should configure QLM as follows in order to store license information at the machine level.
QlmStoreKeysOptions: EStoreKeysPerMachine
When launching the wizard, you must launch the wizard with elevated privileges.
If the service is running with the credentials of a specific user account, you should configure QLM as follows in order to store license information at the user level and machine level.
QlmStoreKeysOptions: EStoreKeysPerUserAndMachine
When launching the wizard, you must launch the wizard with the same account used to run the service.
Sample
A C# sample can be found here: %Public%\Documents\Quick License Manager\Samples\qlmpro\Windows\DotNet\C#\QlmServiceSample
Last updated