web.co/nfig dosyasında IronXL Lisansını Yapılandırma (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 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>
XML

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

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.

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,052,917 | Sürüm: 2026.6 just released
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.