Network Licensed Windows Application Starter Kit

This sample demonstrates a typical Windows application protected by DeployLX Licensing. The licensed application can be shared by multiple users on the network after installing a shared network license service to monitor application usage. 

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.

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
  1. Open the Solution Explorer.
  2. Right-click the Solution node and select Properties.
  3. Select Common Properties | Startup Project on the left.
  4. Select Multiple startup projects.
  5. Change Action to Start for the LicenseServer and Network Licensed Windows Application Starter Kit projects.
  6. Change Action to Start without debugging for the Network Service project.
  7. 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
  1. Open DeployLX
  2. Open the sample license file by selecting the Application Icon (Blue shield) | Open.
  3. Navigate to the root language folder for the starter kit (C# or Visual Basic) and select runtime.lic.
  4. Select the Network Server License from the list of licenses.
  5. Select Generate Code | Generate Serial Number.
  6. Select Generate.
  7. Copy the serial number and switch back to the "Register Network Starter Kit Service" window and enter your details.
  8. 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.

Network Authority

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
  1. From DeployLX, open the runtime.lic included in the sample project.
  2. Select Create Authority from the Ribbon.
  3. 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.
  4. 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.
  5. 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. 

    LicenseHelper Class

    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.

    Published : Aug 23, 2010
    Updated : Jan 04, 2012
    Views : 6298