SLPS Developer Discussion Developer level questions on Code Protection, Licensing, customisation APIs etc
InishTech Support Forums > SLPS Developer Discussion > "licensing storage is not configured" error in LicAdmin, CodeProtector or SLPS V3 protected applications Login to add this as a favourite.
User avatar
Member
Member
will - 10/20/2009 3:04:39 PM
   
"licensing storage is not configured" error in LicAdmin, CodeProtector or SLPS V3 protected applications

The version of the Licensing Admin that is included with the latest SDK for SLP doesn't appear to create the storage on the target system. When attempting to the the application on Windows Server 2008 I recieved the following error:

licensing storage is not configured. please ensure software has been installed correctly

However, running the older version opened the application as expected, after closing and trying again with the version included in V3 the application worked fine.


User avatar
Member
Member
xvue - 10/20/2009 3:07:46 PM
   
RE:Microsoft.Licensing.LicAdmin.exe V3

Same issue here too. Tried with 32 and 64 bit. In clean system it doesnt work with the above mentioned message. Only by running once the old version allows afterwards full usage of the new one.

Its kind of urgent please to give us some details of how to overcome this.

Best regards,

Angelos


User avatar
Member
Member
xvue - 10/20/2009 4:07:43 PM
   
RE:Microsoft.Licensing.LicAdmin.exe V3

One more note on the above issue. the trick for running the old licensing in order for the new one to work is ok only on XP 32 and 64 bit and not on Windows 7 64 bit which makes sense if in order for the new license to work we need to setup something during installation on the registry.

We havent any samples of how to build a proper msi.

Waiting for your responce,

Best regards,

Angelos


User avatar
InishTech Dev
InishTech Dev
RBartelink - 10/20/2009 7:15:21 PM
   
RE: "licensing storage is not configured" error in LicAdmin, CodeProtector or SLPS V3 protected applications

xvue wrote: One more note on the above issue. the trick for running the old licensing in order for the new one to work is ok only on XP 32 and 64 bit and not on Windows 7 64 bit which makes sense if in order for the new license to work we need to setup something during installation on the registry.

Yes, that's true (I was assuming this was on Vista or 7 with UAC off and/or running the apps as administrator ad/or from an administrator command prompt :D)

xvue wrote: We havent any samples of how to build a proper msi.
Waiting for your responce,

A HowTo will be added shortly regarding this. For now, the exec summary is:

1. Add a reference your permutation to your app

2. Add an installer class to your app:- 

using System.ComponentModel;
using Slps.Licensing.Installation;

namespace Slps.VendorTools.MinimalProtectedApp
{
    [RunInstaller(true)]
    public class Installer : PermutationInstallerBase
    {
        public Installer()
            : base( "123XX")
        {
        }
    }
}

3. Add an installation check to your Main() :-

using System;
using Microsoft.Licensing;

namespace Slps.VendorTools.MinimalProtectedApp
{
    class Program
    {
        [STAThread]
        static void Main()
        {
            try
            {
                if (VerifyInstalled())
                    Execute();
            }
            catch (Exception exception)
            {
                    MessageBox.Show(exception.ToString(), "Unhandled Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
       
        static bool VerifyInstalled()
        {
            try
            {
                using ( var installer = new Installer(  ) )
                    installer.VerifyInstalled();
                return true;
            }
            catch (StorageInaccessibleException ex)
            {
                MessageBox.Show(ex.Message, "Licensing installation issue", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
        }
       
        static void Execute()
        {
            // Invoke The rest of your app
        }
    }
}

4. Add a call to the .NET Managed Installer class from your installer:

a) Visual Studio Deployment Projects (.vdproj projects) have a Custom Action option - simply tell it to run the Installer during the "Install" phase. Add "Primary Output from YourApp.exe" to the "Install" step, and set the InstallerClass property to True

b) InstallShield 2009 (and probably earlier versions) have a simple flag for this - you simply indicate that your app's managed installer is to be invoked by ticking a checkbox. Competing products have equivalent features.

c) WiX has a custom action called ManagedInstall in InstallUtilLib. For some more info, see http://www.infoq.com/news/2009/02/WiX30

All of the above are equivalent to using the standard .NET utility 'installutil.exe' which is a standard part of both .NET 1.1 and 2.0 (This approach is also the standard way in which .NET based Windows [NT] Services get registered)


User avatar
Member
Member
wqwalter - 12/9/2009 2:28:23 PM
   
RE: "licensing storage is not configured" error in LicAdmin, CodeProtector or SLPS V3 protected applications

This whole topic and the work flow to use SLP in a Click Once or Setup project still seems confusing to me. Could you extend the medical demo project to have your recommended changes and add a click once and setup project to the solution so you have everything in one example and then do a webcast where you go through the steps of building and deploying the application so we can watch the steps and ask additional questions.

Thanks,

Bill Walter


User avatar
InishTech Dev
InishTech Dev
RBartelink - 10/20/2009 6:23:15 PM
   
"licensing storage is not configured" error in LicAdmin, CodeProtector or SLPS V3 protected applications

Hi Angelos,

I hope the answer to Will's earlier post provides enough information regarding this matter. If not, please feel free to ask any clarifying questions.

xvue wrote: Same issue here too. Tried with 32 and 64 bit. In clean system it doesnt work with the above mentioned message. Only by running once the old version allows afterwards full usage of the new one.

Please note that this workaround may not end up setting the appropriate configuration on the license store if UAC is enabled. This is likely to mean that non-administrators will not be able to run LicAdmin (or your app) correctly even though administrators can.

The recommended approach here is have your installer invoke the .NET Installer class in your app.

If you're just trying to do a quick "xcopy deploy" for test purposes, you could use one of the following approaches: 

1) copy Slps.Runtime.Configuration.exe and its dependencies:-

  • Slps.Runtime.Configuration.exe
  • Slps.Runtime.Installer.dll
  • Microsoft.Licensing.Utils2.0.DLL
  • Microsoft.Licensing.Runtime2.0.DLL
  • Microsoft.Licensing.Permutation2.0.dll

and run

Slps.Runtime.Configuration /Install

OR 2) copy Slps.Runtime.Installer.dll and its dependencies:-

  • Slps.Runtime.Installer.dll
  • Microsoft.Licensing.Utils2.0.DLL
  • Microsoft.Licensing.Runtime2.0.DLL
  • Microsoft.Licensing.Permutation2.0.dll

and run

%windir%\Microsoft.NET\Framework\v2.0.50727\installutil.exe Slps.Runtime.Installer.dll

Please note that the above two techniques are not intended for end-user usage - they're advanced tools that are intended for people developing custom licensing and/or installation schemes.


User avatar
Member
Member
wqwalter - 12/9/2009 2:40:59 PM
   
RE:"licensing storage is not configured" error in LicAdmin, CodeProtector or SLPS V3 protected applications

Should a reference to SLPS.Runtime.Installer.dll be added to my application or is it an external support library used by Slps.Runtime.Configuration.exe. You say this is not intended for the end user. What is the method that should be packed in my end user distribution to get licensing to work correctly?

 

Bill Walter


User avatar
InishTech Dev
InishTech Dev
RBartelink - 12/9/2009 3:37:30 PM
   
RE:"licensing storage is not configured" error in LicAdmin, CodeProtector or SLPS V3 protected applications

Should a reference to SLPS.Runtime.Installer.dll be added to my application or is it an external support library used by Slps.Runtime.Configuration.exe.

It should be considered as an iternal support library of Slps.Runtime.Configuration.exe. (In the current implementation, running:

Slps.Runtime.Configuration.exe /install

 is equivalent to running:

%windir%\Microsoft.NET\Framework[64]\installutil.exe Slps.Runtime.Installer.dll

)

You say this is not intended for the end user. What is the method that should be packed in my end user distribution to get licensing to work correctly?

Correct, the tool should not be shipped to the end-user.

The bits that need to be in an end-user distribution are:

An MSI that contains:

  • An EXE or DLL containing the Installer class
  • The 3 normal SLPS runtime DLLs
  • A call to the installer at install time

The mainline code of any EXE in your distribution that calls protected code should have a VerifyInstalled() guard to advise users of a problem rather than e.g., having that condition being surfaced to user as an exception when they are doing their work.

If you have any further questions, please do not hesitate to ask; For now, I'll not reiterate any further on these topics as there is already too much duplication within this forum thread.

This whole topic and the work flow to use SLP in a Click Once or Setup project still seems confusing to me. Could you extend the medical demo project to have your recommended changes and add a click once and setup project to the solution so you have everything in one example and then do a webcast where you go through the steps of building and deploying the application so we can watch the steps and ask additional questions.

We really appreciate the feedback (yes, especially the negative - particularly when it's constructive like this -thanks)

A link to a HOWTO article covering this will be posted in this topic later today [and linked from here].

Regarding ClickOnce installations we are currently working on providing a seamless way to configure licensing & protection which Just Works without having to configure Post Build Steps etc. This will be shipped together with a modification to the runtime to allow ClickOnce apps to work without requiring one of the current two workarounds (out-of-band configurign of registry permissions OR implementing a Virtual Registry customisation). We are targetting end of CY for this.

Regarding samples Your idea of providing a solution that shows all the key items is something we've already identified a need for internally - watch this space. In the interim, here is a summary of the state of play of the various aspects:-

Minimal shell app - The installation HOWTO covers this (all the code is already in this thread)

MSI install - The installation HOWTO covers this (all the code is already in this thread). A pre-canned solution could show a working .vdproj installer. This would not add terribly much though, as it's just a matter of creating an Installer class and then adding a call to it via the Visual Studio menu's Custom Action steps - normally one would already have an installer and would just add the step to that (unless I'm missing something). Whether we do a HOWTO or a screencast to address this is yet to be decided.

ClickOnce install - At the present time, we dont consider the ClickOnce support to be sufficiently clean to document in depth. While someone who understands ClickOnce's intricacies should be able to protect a module successfully, it's just too messy and hard. We are hopeful of providing clean integration via MsBuild in the near term making this something that can be documented in a short HOWTO rather than requiring a complex screencast.

We'll be looking at providing an all-in-one demo solution ASAP, but it will likely not make sense until the ClickOnce / MsBuild support has been completed and released.


User avatar
InishTech Dev
InishTech Dev
RBartelink - 10/20/2009 6:09:28 PM
   
"licensing storage is not configured" error in LicAdmin, CodeProtector or SLPS V3 protected applications

Hi Will,

Please accept our sincere apologies for not having communicated the information in this response at an earlier point,

will wrote: The version of the Licensing Admin that is included with the latest SDK for SLP doesn't appear to create the storage on the target system.

In versions prior to V3 of both LicAdmin and applications using the SVM/Runtime (including ones protected by Code Protector), the first instance that tries to read or write the license store (which by default is registry-based) will attempt to create the key if it is not present. Unfortunately, in order to be able to perform this consistently, administrative privilege is required.

On Windows versions from Vista forward (i.e., Vista, 7, Server 2008, Server 2008 R2 etc.) the security model defaults all apps (even ones invoked by admin users) to running with a restricted token (which grants only the permissions a normal user would have). This would mean that it's not permissible to write entries into the appropriate area of the registry without requiring all protected apps to be run as administrator (just in case it needs to create the registry entries).

Even on Windows XP and Windows Server 2003, the old behaviour can lead to a range of confusing conditions in the case of non-admin users, i.e., admin users will be able to run the software successfully but non-admins will encounter exceptions on the same machine.

will wrote: When attempting to the the application on Windows Server 2008 I recieved the following error: "licensing storage is not configured. please ensure software has been installed correctly". However, running the older version opened the application as expected, after closing and trying again with the version included in V3 the application worked fine.

For the reasons outlined above, in order to offer a consistent and clear experience to users, the amended behaviour is that the runtime will now predictably throw an exception up front if it is invoked without having been installed and configured correctly.

The recommended approach for handling this issue is thus:

1. As part of the installation of the application, call the installer module. This needs to run elevated, i.e., as admin

2. At the start of the application's Main(), add a check that the installation has been carried out properly which displays a diagnostic message (as you've encountered in LicAdmin V3). This check does not require admin privilege or elevation.

While this might appear to make deployment more complex, this does mean that the only point at which a SLPS-protected app require admin user rights is during the first installation. This approach is in accordance with Windows Logo requirements for Vista and later OSes.

A HowTo article will be published shortly regarding this [and linked from here]

More background to the rationale behind this decision:

For LicAdmin (or the runtime in your app) to continue to try to silently fix up the installation if it sees something wrong, it would need administrative privilege to be able to complete this consistently regardless of the OS involved and whether the user is an administrator. To meet this requirement would have required the following:

1. Add an App Manifest that demands UAC elevation (e.g. require a UAC pop-up with Continue on Vista/7/2008/2008R2).

2. On XP and Windows Server 2003, the software would need to check whether the user has administrative privileges and display a "This application needs to be run as administrator, please log out and re-invoke" if the user isn't an administrator.

The aim of the new approach is to provide a consistent behaviour across all platforms which will minimise the testing and troubleshooting effort required of you the ISV.

User avatar
Member
Member
scottymo - 10/30/2009 12:39:25 AM
   
RE:"licensing storage is not configured" error in LicAdmin, CodeProtector or SLPS V3 protected applications

1.) add a reference to Microsoft.Licensing.Runtime2.0.DLL

2.) call

Slps.Licensing.Installation.RuntimeInstallerHelpers.ConfigureLicenseStoresAndPermissions("12345");

where 12345 is the short name used on your Microsoft.Licensing.Permutation_*****_2.0.dll

3.) Make sure all SLP dlls are accessible, either in the GAC or in the directory running the above code.

 


1 2

There are currently no users on-line.

  • Sticky
  • Locked sticky
  • Hot sticky
  • Hot locked sticky
  • Thread
  • Hot thread
  • Locked thread