Ustawianie klucza licencyjnego w Web.config
Problem został rozwiązany w wersji IronQR 2024.3.2.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronQR must be licensed for development.
Dla starszych wersji IronQR, konkretnie tych wydanych przed wersją 2024.3.2, istnieje znany problem licencyjny w:
- projektach ASP.NET
- wersjach .NET Framework >= 4.6.2
Klucz przechowywany w pliku Web.config NIE zostanie rozpoznany i użyty przez produkt.
Obejście
Aby rozwiązać ten problem, zaleca się pobranie klucza licencyjnego z pliku Web.config za pomocą ConfigurationManager w kodzie, a następnie zastosowanie go do właściwości License.LicenseKey.
Przykład:
<configuration>
...
<appSettings>
<add key="IronQr.LicenseKey" value="IronQR-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronQr.LicenseKey" value="IronQR-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
Dzięki dostarczonemu powyżej plikowi XML, możemy użyć ConfigurationManager do pobrania wartości klucza licencyjnego i przekazania go do właściwości IronQr.License.LicenseKey.
using System.Configuration;
// Retrieve the license key from the Web.config file's appSettings section
string licenseKey = ConfigurationManager.AppSettings["IronQr.LicenseKey"];
// Apply the retrieved license key to the IronQR LicenseKey property
IronQr.License.LicenseKey = licenseKey;
using System.Configuration;
// Retrieve the license key from the Web.config file's appSettings section
string licenseKey = ConfigurationManager.AppSettings["IronQr.LicenseKey"];
// Apply the retrieved license key to the IronQR LicenseKey property
IronQr.License.LicenseKey = licenseKey;
Imports System.Configuration
' Retrieve the license key from the Web.config file's appSettings section
Dim licenseKey As String = ConfigurationManager.AppSettings("IronQr.LicenseKey")
' Apply the retrieved license key to the IronQR LicenseKey property
IronQr.License.LicenseKey = licenseKey

