Downloading and Preparing the Sample
- Visual Studio 2008 or better
- DeployLX 4.1 or 5.0
- SQL Server Express CE 3.5
Download the sample files, save them to your desktop and extract the files. The starter kit includes both C# and Visual Basic versions. Navigate to the desired language and open the solution file.
The license files and projects have been protected with the default sample keys included with the DeployLX install. All references to the licensing runtime assume that DeployLX was installed to the default location on a 32-bit machine. If you're running a 64-bit OS, or you've installed DeployLX to a different location, you'll need to update the references to point to your installation.
See Building the Licensing Samples for details on updating the sample projects for your machine.
Using your DeployLX License
If you're exploring the trial version of DeployLX, the starter kit will work without changes. If you've purchased DeployLX and you're using the release version you must update the LicenseServer.asmx file to use the serial number issued by XHEO when you purchased.
- Open LicenseServer.asmx in code view
- Add your serial number to the DeployLxSerialNumbers array created in the constructor.
Exploring the Starter Kit
Build & Run
The network license solution includes 3 separate projects that all need to run to observe the network licensing functionality.
|LicenseServer||Hosts the license server used to authorize hardware activations.|
|Network Licensed Windows Application Starter Kit||The sample network client application that connects to a network license service to request permission to run on the network machine.|
|Network Service||The actual network monitoring service that authorizes and manages client machines. The actual project is a utility project that simply copies the network runtime redistributables into your project folder so it can be started and stopped in the debugger.|
To start all projects when debugging
- Open the Solution Explorer.
- Right-click the Solution node and select Properties.
- Select Common Properties | Startup Project on the left.
- Select Multiple startup projects.
- Change Action to Start for the LicenseServer and Network Licensed Windows Application Starter Kit projects.
- Change Action to Start without debugging for the Network Service project.
- Select OK.
Generate Serial Number
The first time you start the application you'll be prompted to "Register Network Start Kit Service". Here DeployLX is prompting to register the network license service - not the windows application. In a network licensed scenario, the end user receives a serial number for the network license monitoring service that they run on their network. Then licensed client applications connect to the centralized network service.
To register the network license service
- Open DeployLX
- Open the sample license file by selecting the Application Icon (Blue shield) | Open.
- Navigate to the root language folder for the starter kit (C# or Visual Basic) and select runtime.lic.
- Select the Network Server License from the list of licenses.
- Select Generate Code | Generate Serial Number.
- Select Generate.
- Copy the serial number and switch back to the "Register Network Starter Kit Service" window and enter your details.
- Select Register and the network service starts.
Install SQL Server CE
The first time the network service starts it checks that SQL Server CE 3.5 is available on the machine. When running the network service as a tray application, it will prompt the user to install SQL Server and offers a button to install. When running as a Windows Service, DeployLX will log an exception to the Windows Event Log.
The network license service is a stand alone application that you distribute to your customers to be installed on a server on their network. This same application is used by all applications protected by DeployLX network licensing. To allow DeployLX to securely authorize network client requests, you provide a NlmAuthority.dll that has been built with your private license keys, contains support contact info for the network license service and includes a default client network license that can be auto distributed to network clients.
The sample project includes a NlmAuthority.dll in the Network Service project. You can re-create your own NlmAuthority with your own license keys.
To create your own NlmAuthority.dll
- From DeployLX, open the runtime.lic included in the sample project.
- Select Create Authority from the Ribbon.
- The Network License (defines the restrictions on the network license service itself - such as only allowed to be installed on one machine) and Client License (defines the behavior of client applications and which network ports and keys should be used) have already been filled in for you.
- Enter any desired support info. If left blank, generic information will be displayed to the user. At a minimum you should fill in the Product and Company fields.
- Select Generate and save the NlmAuthority.dll into the Network Service project.
The runtime.lic is then compiled into an NlmAuthority. When the network license service starts, it loads the NlmAuthority and demands permission to run the network license service. It then starts up and listens for network client requests.
The LicenseHelper class serves as a utility class for interacting with the DeployLX Licensing runtime. It was generated automatically by the Protect Project wizard in DeployLX. The default implementation works for the most common scenarios, and can be customized to meet individual application requirements.
When the application is started, the MainForm creates a new instance of the LicenseHelper class and invokes the Required method. The Required method in turn prepares a request to the licensing runtime and asks for a valid license. If a valid license cannot be found, then an exception is logged and thrown. If a valid license can be found, it is saved and used to expose properties of the license state. After a valid license has been obtained, the MainForm updates it's menu's and controls to reflect the license state.