Web.configにライセンスキーを設定する
この問題はIronPDFバージョン2024.3.3以降で解決済みです。
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPDF must be licensed for development.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPDF must be licensed for development.
古いバージョンのIronPDF、特にバージョン2023.4.4から2024.3.3の間には、次のライセンス問題が知られています:
- ASP.NET プロジェクト
-
.NET Framework バージョン >= 4.6.2
Web.config
ファイルに保存されたキーは、製品によって使用されません。
ワークアラウンド
この問題に対処するには、Web.config
ファイルからConfigurationManagerを使用してライセンスキーを取得し、それをLicense.LicenseKeyプロパティに適用することをお勧めします。
例:
<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>
上記のXMLファイルを使用して、ConfigurationManagerを使い、ライセンスキーの値を取得し、それをIronPdf.License.LicenseKeyプロパティに渡すことができます。
using System.Configuration;
string licenseKey = ConfigurationManager.AppSettings ["IronPdf.LicenseKey"];
IronPdf.License.LicenseKey = licenseKey;
using System.Configuration;
string licenseKey = ConfigurationManager.AppSettings ["IronPdf.LicenseKey"];
IronPdf.License.LicenseKey = licenseKey;
Imports System.Configuration
Private licenseKey As String = ConfigurationManager.AppSettings ("IronPdf.LicenseKey")
IronPdf.License.LicenseKey = licenseKey