Configure IronXL License in web.config (C#)
Sorun, IronXL sürüm 2024.3.20 itibariyle cozuldu.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronXL must be licensed for development.
Özellikle 2023.4.13 ve 2024.3.20 sürümleri arası daha eski IronXL sürümleri için, şu lisanslama sorunu bilinmektedir:
- ASP.NET projeleri
- .NET Framework sürümü >= 4.6.2
Web.config dosyasinda saklanan anahtar, ürün tarafindan KESINLIKLE alinmayacak ve kullanilmayacak.
Geçici Çözüm
Bu sorunu gidermek icin, kodda ConfigurationManager kullanarak Web.config dosyasindan lisans anahtarinin alinmasi ve daha sonra License.LicenseKey ozelligine uygulanmasi onerilir.
Örnek:
Web.config dosyasinda lisans anahtarini nasıl saklayacaginiza dair bir örnek asagida verilmistir:
<configuration>
...
<appSettings>
<add key="IronXl.LicenseKey" value="IronXL-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronXl.LicenseKey" value="IronXL-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
Yukaridaki XML dosya duzeni ile, lisans anahtari degerini almak ve IronXl.License.LicenseKey ozelligine ayarlamak icin ConfigurationManager kullanabiliriz:
using System.Configuration;
// Retrieve the license key from the Web.config appSettings section
string licenseKey = ConfigurationManager.AppSettings["IronXl.LicenseKey"];
// Apply the retrieved license key to the IronXL component
IronXl.License.LicenseKey = licenseKey;
using System.Configuration;
// Retrieve the license key from the Web.config appSettings section
string licenseKey = ConfigurationManager.AppSettings["IronXl.LicenseKey"];
// Apply the retrieved license key to the IronXL component
IronXl.License.LicenseKey = licenseKey;
Imports System.Configuration
' Retrieve the license key from the Web.config appSettings section
Dim licenseKey As String = ConfigurationManager.AppSettings("IronXl.LicenseKey")
' Apply the retrieved license key to the IronXL component
IronXl.License.LicenseKey = licenseKey
Bu örnekte, ConfigurationManager.AppSettings, IronXl.LicenseKey degerini Web.config'den almak icin kullanilir. Alinan lisans anahtari daha sonra IronXL bileşenlerinin duzgun çalışabilmesi için IronXl.License.LicenseKey'e ayarlanır.

