Web.config'te IronZIP Lisans Kurulumu
Bu sorun, 2024.3.3 tarihinden önce yayımlanan IronZIP sürümlerini etkilediği bilinir.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
Özellikle sürüm 2024.3.3 öncesinde yayımlanan eski IronZIP sürümleri için bilinen bir lisanslama sorunu bulunmaktadır:
- ASP.NET projeleri
- .NET Framework sürümü >= 4.6.2
Web.config dosyasında saklanan anahtar ürün tarafından KULLANILMAYACAKTIR.
Geçici Çözüm
Bu sorunu çözmek için, lisans anahtarının Web.config dosyasından ConfigurationManager kullanılarak kod içinde alınması ve ardından License.LicenseKey özelliğine uygulanması önerilir.
Örnek:
<configuration>
...
<appSettings>
<add key="IronZip.LicenseKey" value="IRONZIP.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
Yukarıda sağlanan XML dosyası ile, lisans anahtarının değeri almak ve bunu IronZip.License.LicenseKey özelliğine iletmek için ConfigurationManager kullanabiliriz.
using System;
using System.Configuration;
class Program
{
static void Main()
{
// Retrieve the license key from the web.config appSettings
string licenseKey = ConfigurationManager.AppSettings["IronZip.LicenseKey"];
// Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey;
// Verify that the license key is set properly
Console.WriteLine("License key applied successfully.");
}
}Imports System
Imports System.Configuration
Friend Class Program
Shared Sub Main()
' Retrieve the license key from the web.config appSettings
Dim licenseKey As String = ConfigurationManager.AppSettings("IronZip.LicenseKey")
' Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey
' Verify that the license key is set properly
Console.WriteLine("License key applied successfully.")
End Sub
End ClassImports System
Imports System.Configuration
Friend Class Program
Shared Sub Main()
' Retrieve the license key from the web.config appSettings
Dim licenseKey As String = ConfigurationManager.AppSettings("IronZip.LicenseKey")
' Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey
' Verify that the license key is set properly
Console.WriteLine("License key applied successfully.")
End Sub
End Classusing System.Configuration;yönergesi,Web.configgibi yapılandırma dosyalarına erişim sağlar.ConfigurationManager.AppSettings["IronZip.LicenseKey"],appSettingsbölümünde saklanan lisans anahtarınıWeb.configiçinden alır.IronZip.License.LicenseKey = licenseKey;, lisanslama istisnalarını önlemek için alınan anahtarı IronZIP kütüphanesine atar.Console.WriteLine()ifadesi, geliştiriciye lisans anahtar uygulama sürecinin başarıyla tamamlandığına dair geri bildirim sağlar.
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ılandırılmış, görsel olarak çekici kılavuzlar oluşturmayı seviyor.