Web.co/nfig'de Lisans Anahtarı Ayarlama
Bu sorun, IronOCR sürüm 2024.3.4'ten itibaren çözülmüştür.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronOCR must be licensed for development.
Eski IronOCR sürümlerinde, özellikle 2023.4.13 ile 2024.3.4 arasındaki sürümlerde, şu konuda bilinen bir lisans sorunu bulunmaktadır:
- ASP.NET projeleri
- .NET Framework sürümü >= 4.6.2
Web.co/nfig dosyasında depolanan anahtar, ürün tarafından ALINMAYACAK ve KULLANILMAYACAKTIR.
Çözüm
Bu sorunu çözmek için, koddaki ConfigurationManager'ı kullanarak Web.co/nfig dosyasından lisans anahtarını almanız ve ardından bunu License.LicenseKey özelliğine uygulamanız önerilir.
Örnek:
<configuration>
...
<appSettings>
<add key="IronOcr.LicenseKey" value="IRONOCR-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronOcr.LicenseKey" value="IRONOCR-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
Yukarıda sağlanan XML dosyası ile ConfigurationManager'ı kullanarak lisans anahtarı değerini alabilir ve bunu IronOcr.License.LicenseKey özelliğine aktarabiliriz.
using System.Co/nfiguration;
// Retrieve the license key from the Web.co/nfig's appSettings
string licenseKey = ConfigurationManager.AppSettings["IronOcr.LicenseKey"];
// Apply the license key to IronOcr to avoid licensing exceptions
IronOcr.License.LicenseKey = licenseKey;
using System.Co/nfiguration;
// Retrieve the license key from the Web.co/nfig's appSettings
string licenseKey = ConfigurationManager.AppSettings["IronOcr.LicenseKey"];
// Apply the license key to IronOcr to avoid licensing exceptions
IronOcr.License.LicenseKey = licenseKey;
Imports System.Configuration
' Retrieve the license key from the Web.config's appSettings
Dim licenseKey As String = ConfigurationManager.AppSettings("IronOcr.LicenseKey")
' Apply the license key to IronOcr to avoid licensing exceptions
IronOcr.License.LicenseKey = licenseKey

