Web.config içinde Lisans Anahtarı Ayarlama
Bu problem, 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 arasındaki sürümler için IronPDF için bilinen bir lisans sorunu var:
- ASP.NET projeleri
- .NET Framework sürümü >= 4.6.2
Anahtar, Web.config dosyasında depolansa da, ürün tarafından ASLA alınmayacak ve kullanılmayacaktır.
Geçici Çözüm
Bu sorunu çözmek için, kod içinde ConfigurationManager kullanarak lisans anahtarını Web.config dosyasından almanız ve 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 ConfigurationManager kullanarak lisans anahtarı değerini alabilir ve bunu IronPdf.License.LicenseKey özelliğine iletebiliriz.
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

