IronXL Lisansını web.config (C#) olarak yapılandırın

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

Problem IronXL sürümü itibariyle 2024.3.20 çözüldü.

Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronXL must be licensed for development.

Daha eski IronXL sürümleri, özellikle 2023.4.13 ve 2024.3.20 versiyonları arasında bilinen bir lisanslama sorunu bulunmaktadır:

  • ASP.NET projeleri
  • .NET Framework sürümü >= 4.6.2

Anahtar, Web.config dosyasında depolanırsa üründe KULLANILMAYACAKTIR.

Geçici Çözüm

Bu sorunu çözmek için, kodda ConfigurationManager kullanarak Web.config dosyasından lisans anahtarını almanız ve ardından License.LicenseKey özelliğine uygulamanız önerilir.

Örnek:

Aşağıda, lisans anahtarını bir Web.config dosyasında nasıl depolayacağınıza dair bir örnek bulunmaktadır:

<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

Yukarıdaki XML dosyası kurulumu ile lisans anahtarının değerini almak ve IronXL.License.LicenseKey özelliğine ayarlamak için 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
Private 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 değerini Web.config içerisinden almak için kullanılır. Alınan lisans anahtarı, IronXL bileşenlerinin düzgün çalışabilmesini sağlamak amacıyla IronXL.License.LicenseKey özelliğine ayarlanır.

Curtis Chau
Teknik Yazar

Curtis Chau, Bilgisayar Bilimleri alanında Lisans Derecesine (Carleton Üniversitesi) sahip ve Node.js, TypeScript, JavaScript ve React konularında uzmanlaşmış ön uç geliştirmeyle ilgileniyor. Sezgisel ve estetik açıdan hoş kullanıcı arayüzleri oluşturma tutkunu, Curtis modern çerçevelerle çalışmayı ve iyi yapı...

Daha Fazla Oku
Başlamaya Hazır mısınız?
Nuget İndirmeler 2,134,203 | Sürüm: 2026.7 yeni yayınlandı
Still Scrolling Icon

Hâlâ Kaydırıyor Musunuz?

Hızlıca kanıt ister misiniz? PM > Install-Package IronXL.Excel
örnek çalıştır verinizin bir hesap tablosu haline geldiğini izleyin.