This is the online documentation for PostSharp 5.0.
Download PDF or CHM. Go to v4.3 or v5.0

Installing and Servicing PostSharp License Server

This topic covers PostSharp License Server from the point of view of the system administrator and license administrator.

We designed our license server to help our customers, not to enforce our license agreements. The application is not obfuscated, it uses a clear SQL database and provides the ability to workaround issues by canceling leases or purging tables.

This topic contains the following sections:

System Requirements

PostSharp License Server is an ASP.NET 4.0 application backed by a Microsoft SQL database.

It requires:

  • Windows Server 2003 or later with Internet Information Services installed.

  • Microsoft SQL Server 2005 or later (any edition, including the Express edition).

If the license server can be configured with a sufficiently long lease renewal period, there is no need to deploy the application and its database in high-availability conditions. You need to plan that the amount of time between the lease renewal and the lease end is larger than the longest expected outage. Frequent backups are not critical unless usage information is required for accounting purposes in case of pay-as-you-use licenses, where the Export Logs feature is required.

Caution note Caution

Deploying the ASP.NET application to several machines is not supported because the lease algorithm uses application locking instead of database locking.

Installing PostSharp License Server

The setup procedure is simple but must be performed manually.

To install PostSharp License Server, you will need administrative access on a Windows Server machine and the permission to create a new database.

To install PostSharp License Server:

  1. Download the latest version of PostSharp License Server from the PostSharp website. For version 3.1.44, the URL is http://www.postsharp.net/downloads/postsharp-3.1/v3.1.44/SharpCraftersLicenseServer-3.1.44.zip. You can open the download manager at http://www.postsharp.net/downloads/ and browse to the version you are interested in.

    Note Note

    It is not necessary that the version of PostSharp License Server exactly matches the version of PostSharp. You do not have to upgrade PostSharp License Server as long as the license keys you want to use are compatible with the server version.

  2. Using Internet Information Services (IIS) Manager, configure a new web application whose root is the folder containing the file web.config.

  3. The application pool should be configured to use ASP.NET 4.0.

  4. Configure the authentication mode of the web application: disable Anonymous Authentication, and enable Windows Authentication.

  5. Create an MS SQL database (the free MS SQL Express server is supported).

  6. Execute the script CreateTables.sql in the context of this database. The file is located in the zip archive of the license server.

  7. Set up security on this database so that the user account under which the ASP.NET application pool is running (typically NETWORK SERVICE) can access the database.

  8. Edit the file web.config:

    1. configuration/connectionStrings: Correct the connection string (server name and database name) to match your settings.

    2. configuration/system.net/mailSettings: Set the name of the SMTP server used to send warning emails.

    3. configuration/applicationSettings: this section contains several settings that are documented inside the web.config file. The most important settings are the email addresses for shortage notifications and the duration of leases duration and renewal delay.

    4. configuration/system.web/authorization: Set up security of the whole application to restrict the persons who are allowed to borrow a license. Optional.

    5. configuration/location[@path='Admin']/system.web/authorization: Specify who has access to the administrative interface of the application. Optional.

Installing a license key

Before developers can start using the license server, you need to install a license key.

To install a license key into the license server:

  1. Open the home page of the license server using a web browser.

  2. Click on the link Install a new license.

  3. Paste the license key and click on button Add.

    License Server 1
Testing the license server

If you have installed the license server at the address http://localhost/PostSharpLicenseServer, you can test it opening the URL http://localhost/PostSharpLicenseServer/Lease.ashx?product=PostSharp30&user=me&machine=other using Firefox or Chrome. If the license acquisition was successful, the browser will display the license key and the duration of the lease. You can also then see the resulting allocation on the home page http://localhost/PostSharpLicenseServer, and cancel the lease.

Displaying license usage

PostSharp License Server makes it easy to know how many people are currently using the product, and to display historical data.

Overview of installed license keys and current number of leases
License Server 2

Detail of leases
License Server 3

History of license usage. The figure demonstrates a 30-day, +30% grace period.
License Server 4
Canceling leases

You can cancel a lease from the lease list by clicking on the Cancel hyperlink. Note that canceling a lease on the server does not cancel the lease on the client. It is not possible to cancel leases on the client.

Maintenance

The license server is designed to keep a history of all leases. Therefore, it can grow indefinitely, depending on the number of users and lease duration. It is safe to delete all records from the Lease table at any time, unless these records are necessary for accounting purposes.

Using SQL Agent, you can schedule a job that purges old records of the Lease table:

DELETE FROM [dbo].[Leases] WHERE EndTime < DATEADD( day, -90, GETDATE() );