Dépannage de la configuration de la licence IronPrint
Le problème a été résolu à partir de la version 2024.3.6 IronPrint .
# This shell output shows an unhandled exception error due to missing license for IronPrint.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPrint must be licensed for development.
# This shell output shows an unhandled exception error due to missing license for IronPrint.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPrint must be licensed for development.
Pour les anciennes versions d'IronPrint, en particulier celles publiées avant la version 2024.3.6 , il existe un problème de licence connu :
- projets ASP.NET
- version .NET Framework >= 4.6.2
La clé stockée dans un fichier Web.config ne sera PAS récupérée et utilisée par le produit.
Solution de contournement
Pour résoudre ce problème, il est recommandé de récupérer la clé de licence à partir du fichier Web.config en utilisant ConfigurationManager dans le code, puis de l'appliquer à la propriété License.LicenseKey.
Exemple :
<configuration>
...
<appSettings>
<add key="IronPrint.LicenseKey" value="IRONPRINT.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronPrint.LicenseKey" value="IRONPRINT.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
Avec le fichier XML fourni ci-dessus, nous pouvons utiliser ConfigurationManager pour récupérer la valeur de la clé de licence et la transmettre à la propriété IronPrint.License.LicenseKey .
using System;
using System.Configuration;
namespace IronPrintLicenseSetup
{
class Program
{
static void Main()
{
// Retrieve the license key from the appSettings section of the Web.config file.
string licenseKey = ConfigurationManager.AppSettings["IronPrint.LicenseKey"];
// Apply the retrieved license key to the IronPrint's LicenseKey property.
IronPrint.License.LicenseKey = licenseKey;
// Notify user that the license key has been applied.
Console.WriteLine("License Key has been applied successfully.");
}
}
}
using System;
using System.Configuration;
namespace IronPrintLicenseSetup
{
class Program
{
static void Main()
{
// Retrieve the license key from the appSettings section of the Web.config file.
string licenseKey = ConfigurationManager.AppSettings["IronPrint.LicenseKey"];
// Apply the retrieved license key to the IronPrint's LicenseKey property.
IronPrint.License.LicenseKey = licenseKey;
// Notify user that the license key has been applied.
Console.WriteLine("License Key has been applied successfully.");
}
}
}
Imports System
Imports System.Configuration
Namespace IronPrintLicenseSetup
Friend Class Program
Shared Sub Main()
' Retrieve the license key from the appSettings section of the Web.config file.
Dim licenseKey As String = ConfigurationManager.AppSettings("IronPrint.LicenseKey")
' Apply the retrieved license key to the IronPrint's LicenseKey property.
IronPrint.License.LicenseKey = licenseKey
' Notify user that the license key has been applied.
Console.WriteLine("License Key has been applied successfully.")
End Sub
End Class
End Namespace
Dans l'exemple ci-dessus, le ConfigurationManager.AppSettings est utilisé pour récupérer la clé de licence directement à partir du Web.config. La clé est alors définie comme LicenseKey pour le composant IronPrint , garantissant ainsi que l'application dispose de la licence nécessaire pour fonctionner correctement.

