Web.config Dosyasında Lisans Anahtarını Ayarlama
Bu sorun IronPDF 2024.3.3 sürümünden itibaren çözüldü.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPDF must be licensed for development.
Özellikle 2023.4.4 ve 2024.3.3 sürümleri arasındaki eski IronPdf sürümleri için, aşağıdaki durumlarda bilinen bir lisanslama sorunu bulunmaktadır:
- ASP.NET projeleri
- .NET Framework sürümü >= 4.6.2
Anahtar, Web.config dosyasına kaydedildiğinde, ürün tarafından KULLANILMAYACAK ve alınmayacaktır.
Geçici Çözüm
Bu sorunu çözmek için, lisans anahtarını kod içinde ConfigurationManager kullanarak Web.config dosyasından alıp, ardından License.LicenseKey özelliğine uygulamanız önerilir.
Örnek:
<configuration>
...
<appSettings>
<add key="IronPdf.LicenseKey" value="IRONPDF-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronPdf.LicenseKey" value="IRONPDF-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
Yukarıda sağlanan XML dosyası ile, lisans anahtar değerini almak ve IronPdf.License.LicenseKey özelliğine iletmek için ConfigurationManager kullanabiliriz.
using System.Configuration;
class Program
{
static void Main()
{
// Retrieve the license key from the Web.config file
string licenseKey = ConfigurationManager.AppSettings["IronPdf.LicenseKey"];
// Apply the license key to the IronPdf library
IronPdf.License.LicenseKey = licenseKey;
// Additional processing can continue here
}
}
using System.Configuration;
class Program
{
static void Main()
{
// Retrieve the license key from the Web.config file
string licenseKey = ConfigurationManager.AppSettings["IronPdf.LicenseKey"];
// Apply the license key to the IronPdf library
IronPdf.License.LicenseKey = licenseKey;
// Additional processing can continue here
}
}
Imports System.Configuration
Friend Class Program
Shared Sub Main()
' Retrieve the license key from the Web.config file
Dim licenseKey As String = ConfigurationManager.AppSettings("IronPdf.LicenseKey")
' Apply the license key to the IronPdf library
IronPdf.License.LicenseKey = licenseKey
' Additional processing can continue here
End Sub
End Class

