Web.config Dosyasında Lisans Anahtarını Ayarlama
Bu sorun, IronOCR sürüm 2024.3.4 itibariyle çözüldü.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronOCR must be licensed for development.
Older IronOcr sürümleri, özellikle 2023.4.13 ile 2024.3.4 arasındaki sürümler için, şu bilinen bir lisanslama sorunu vardır:
- ASP.NET projeleri
- .NET Framework sürümü >= 4.6.2
Bir Web.config dosyasına kaydedilen anahtar ürün tarafından KULLANILMAZ.
Geçici Çözüm
Bu sorunu çözmek için, kod içinde ConfigurationManager kullanarak Web.config dosyasından lisans anahtarını almak ve ardından License.LicenseKey özelliğine uygulamak ö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, lisans anahtar değerini almak ve IronOcr.License.LicenseKey özelliğine iletmek için ConfigurationManager kullanabiliriz.
using System.Configuration;
// Retrieve the license key from the Web.config's appSettings
string licenseKey = ConfigurationManager.AppSettings["IronOcr.LicenseKey"];
// Apply the license key to IronOcr to avoid licensing exceptions
IronOcr.License.LicenseKey = licenseKey;
using System.Configuration;
// Retrieve the license key from the Web.config'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
Private licenseKey As String = ConfigurationManager.AppSettings("IronOcr.LicenseKey")
' Apply the license key to IronOcr to avoid licensing exceptions
IronOcr.License.LicenseKey = licenseKey

