IronOCR-Lizenzkonfiguration in web.config
Das Problem wurde mit IronZIP Version 2024.3.3 behoben .
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
Für ältere IronZIP-Versionen, speziell die, die vor Version 2024.3.3 veröffentlicht wurden, gibt es ein bekanntes Lizenzproblem in:
- ASP.NET-Projekten
- .NET Framework Version >= 4.6.2
Der in einer Web.config Datei gespeicherte Schlüssel wird vom Produkt NICHT erkannt und verwendet.
Problemumgehung
Um dieses Problem zu beheben, wird empfohlen, den Lizenzschlüssel aus der Datei Web.config mithilfe des ConfigurationManager im Code abzurufen und ihn dann auf die Eigenschaft License.LicenseKey anzuwenden.
Beispiel:
<configuration>
...
<appSettings>
<add key="IronZip.LicenseKey" value="IRONZIP.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronZip.LicenseKey" value="IRONZIP.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
Mit der oben bereitgestellten XML-Datei können wir ConfigurationManager verwenden, um den Lizenzschlüsselwert abzurufen und ihn an die IronZip.License.LicenseKey-Eigenschaft zu übergeben.
using System;
using System.Configuration;
class Program
{
static void Main()
{
// Retrieve the license key from the web.config appSettings
string licenseKey = ConfigurationManager.AppSettings["IronZip.LicenseKey"];
// Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey;
// Verify that the license key is set properly
Console.WriteLine("License key applied successfully.");
}
}
using System;
using System.Configuration;
class Program
{
static void Main()
{
// Retrieve the license key from the web.config appSettings
string licenseKey = ConfigurationManager.AppSettings["IronZip.LicenseKey"];
// Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey;
// Verify that the license key is set properly
Console.WriteLine("License key applied successfully.");
}
}
Imports System
Imports System.Configuration
Friend Class Program
Shared Sub Main()
' Retrieve the license key from the web.config appSettings
Dim licenseKey As String = ConfigurationManager.AppSettings("IronZip.LicenseKey")
' Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey
' Verify that the license key is set properly
Console.WriteLine("License key applied successfully.")
End Sub
End Class
- Die Direktive
using System.Configuration;ermöglicht den Zugriff auf Konfigurationsdateien, wie z. B.Web.config. ConfigurationManager.AppSettings["IronZip.LicenseKey"]ruft den im AbschnittappSettingsvonWeb.configgespeicherten Lizenzschlüssel ab.IronZip.License.LicenseKey = licenseKey;weist den abgerufenen Schlüssel der IronZIP -Bibliothek zu, um Lizenzierungsausnahmen zu vermeiden.- Die Meldung
Console.WriteLine()gibt dem Entwickler die Rückmeldung, dass der Lizenzschlüsselantragsprozess erfolgreich abgeschlossen wurde.

