Configure IronXL License in web.config (C#)

This article was translated from English: Does it need improvement?
Translated
View the article in English

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>
XML

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
$vbLabelText   $csharpLabel

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.

Curtis Chau
Teknik Yazar

Curtis Chau, Bilgisayar Bilimleri alanında lisans derecesine sahiptir (Carleton Üniversitesi) ve Node.js, TypeScript, JavaScript ve React konularında uzmanlaşmış ön uç geliştirme üzerine uzmanlaşmıştır. Kullanıcı dostu ve estetik açıdan hoş arayüzler tasarlamaya tutkuyla bağlı olan Curtis, modern çerç...

Daha Fazlasını Oku
Başlamaya Hazır mısınız?
Nuget İndirmeler 1,974,422 | Sürüm: 2026.4 just released
Still Scrolling Icon

Hala Kaydiriyor musunuz?

Hızlı bir kanit mi istiyorsunuz? PM > Install-Package IronXl.Excel
bir örnek çalıştırın verilerinizin bir elektronik tabloya dönüştüğünü izleyin.