web.co/nfig dosyasında IronXL Lisansını Yapılandırma (C#)
Sorun, IronXL sürüm 2024.3.20 ile çözülmüştür.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronXL must be licensed for development.
Eski IronXL sürümlerinde, özellikle 2023.4.13 ile 2024.3.20 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:
Aşağıda, lisans anahtarının bir Web.co/nfig dosyasına nasıl kaydedileceğine dair bir örnek verilmiştir:
<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>
Yukarıdaki XML dosyası yapılandırmasıyla, ConfigurationManager'ı kullanarak lisans anahtarı değerini alabilir ve bunu IronXl.License.LicenseKey özelliğine ayarlayabiliriz:
using System.Co/nfiguration;
// Retrieve the license key from the Web.co/nfig appSettings section
string licenseKey = ConfigurationManager.AppSettings["IronXl.LicenseKey"];
// Apply the retrieved license key to the IronXL component
IronXl.License.LicenseKey = licenseKey;
using System.Co/nfiguration;
// Retrieve the license key from the Web.co/nfig 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'nin değerini Web.co/nfig'den almak için kullanılır. Alınan lisans anahtarı daha sonra IronXl.License.LicenseKey olarak ayarlanır ve böylece IronXL bileşenlerinin düzgün çalışması sağlanır.

