web.config dosyasında IronOCR Lisans Kurulumu
Sorun, IronZip sürüm 2024.3.3 ile çözülmüştür.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
Eski IronZip sürümlerinde, özellikle 2024.3.3 sürümünden önce yayınlananlarda, şu lisans sorunu bilinmektedir:
- ASP.NET projeleri
- .NET Framework sürümü >= 4.6.2
Web.config dosyasında depolanan anahtar, ürün tarafından ALINMAYACAK ve KULLANILMAYACAKTIR.
Çözüm
Bu sorunu çözmek için, koddaki ConfigurationManager'ı kullanarak Web.config dosyasından lisans anahtarını almanız ve ardından bunu License.LicenseKey özelliğine uygulamanız önerilir.
Örnek:
<configuration>
...
<appSettings>
<add key="IronZip.LicenseKey" value="IRONZIP.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
Yukarıda sağlanan XML dosyası ile ConfigurationManager'ı kullanarak lisans anahtarı değerini alabilir ve bunu IronZip.License.LicenseKey özelliğine aktarabiliriz.
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 Classusing System.Configuration;yönergesi,Web.configgibi yapılandırma dosyalarına erişim sağlar.ConfigurationManager.AppSettings["IronZip.LicenseKey"],appSettingsbölümünde depolanan lisans anahtarınıWeb.config'den alır.IronZip.License.LicenseKey = licenseKey;, lisans istisnalarını önlemek için alınan anahtarı IronZIP kütüphanesine atar.Console.WriteLine()ifadesi, lisans anahtarı başvuru sürecinin başarıyla tamamlandığını geliştiriciye bildirir.

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.