Network License Validation

Using a shared license managed by a central Network License Service is achieved by configuring the protected software to connect to a Network License Service and then invoking remote license requests.

Using Agile.net Licensing API

Remote license request invocation is managed through Agile.net licensing API, therefore you must add a reference to AgileDotNet.Licensing assembly to your project. You will also need to add a reference to a file containing the public key information used to validate the network license to ensure it has been created by an authorized user and haven't been tampered by a third party.

If you develop C# or VB.NET projects you may seamlessly integrate your project with Agile.net Copy Protection using the project wizard, otherwise you will have to manually protect your project.

Connecting to the Network License Service

The protected software acts as a Network Client, issuing license requests to a remote Network License Service. To configure the Network License Service location call the AgileDotNetLicenseProvider.AddNetworkLicenseService method using the Network License Service IP and port.

Invoking a license request

Once connected to the network license service, the protected software requests permission to use a named product feature on the machine. This is done by checking out product features, if the total number of active clients is less than the number allowed by the product feautre count specificed then validation will succeed. When the total number of allowed licenses has been reached the user must wait for another user to finish. Returning the product feature is done by checking it in, the Network License Service can then authorize another client requesting to use the returned product feature.

To check a product feature in or out:

 public static void ValidateNetworkLicense()
 {
   AgileDotNetLicenseProvider.AddNetworkLicenseService(new IPEndPoint(IPAddress.Parse("192.186.0.2"), 8127));
 
   AgileDotNetLicense license = AgileDotNetLicenseProvider.Validate(null , null);
 
   FeatureLock featureLock = license.GetLocks<FeatureLock >().Single();
 
   LicenseFeature licenseFeature = featureLock.Features.Single(x => x.Name == "ProductFeature1");
 
   licenseFeature.Checkout();
 }
 

Session Timeout

The protected software sends a message periodically to the network license service to indicate that the client is alive and using the license. When the network license service fails to receive the message for a period (Session Timeout) the client is considered dead and the license is released. The session timeout defines how long the service will wait for the client to send a message before considering the license available for another client.

By default the session timeout is set to 30 seconds, to change the session timeout period:

  • Open AgileDotNet.NetworkLicenseService.exe.config using a text editor.
  • Modify session timeout setting.
  • Restart the Network License Service.

License Lost Event

After a license request has been authorized by the Network License Service the protected software constantly monitors that the network license service is alive and that the communication channel between the protected software and Network License Service remains uninterrupted. When the protected software identifies that either the service is down or communication channel is broken it fires a LicenseFeatureLost event, to subscribe on this event register on AgileDotNetLicense.LicenseFeatureLost event.

Network License Search Order

When the AgileDotNetLicenseProvider.Validate method is called, Agile.net start searching for a valid license on the local machine. While searching for a license each license file is validated to determine if it meets all the required locks defined in the license. In case a valid license is found on the local machine the protected software will not continue to search for a network license. Only if no valid license is found locally the search continues and any network license services configured by calling AgileDotNetLicenseProvider.AddNetworkLicenseService are consulted.