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:
PostSharp License Server is an ASP.NET 4.0 application backed by a Microsoft SQL database.
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.
Deploying the ASP.NET application to several machines is not supported because the lease algorithm uses application locking instead of database locking.
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:
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.
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.
Using Internet Information Services (IIS) Manager, configure a new web application whose root is the folder containing the file web.config.
The application pool should be configured to use ASP.NET 4.0.
Configure the authentication mode of the web application: disable Anonymous Authentication, and enable Windows Authentication.
Create an MS SQL database (the free MS SQL Express server is supported).
Execute the script CreateTables.sql in the context of this database. The file is located in the zip archive of the license server.
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.
Edit the file web.config:
configuration/connectionStrings: Correct the connection string (server name and database name) to match your settings.
configuration/system.net/mailSettings: Set the name of the SMTP server used to send warning emails.
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.
configuration/system.web/authorization: Set up security of the whole application to restrict the persons who are allowed to borrow a license. Optional.
configuration/location[@path='Admin']/system.web/authorization: Specify who has access to the administrative interface of the application. Optional.
Before developers can start using the license server, you need to install a license key.
To install a license key into the license server:
Open the home page of the license server using a web browser.
Click on the link Install a new license.
Paste the license key and click on button Add.
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.
PostSharp License Server makes it easy to know how many people are currently using the product, and to display historical data.
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.
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() );