Web.configにライセンスキーを設定する
この問題は IronOCR バージョン 2024.3.4 から解決済みです。
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronOCR must be licensed for development.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronOCR must be licensed for development.
古いIronOCRバージョン、特に2023.4.13から2024.3.4のバージョンには、既知のライセンス問題があります。
- ASP.NET プロジェクト
-
.NET Framework バージョン >= 4.6.2
Web.config
ファイルに保存されたキーは、製品によって使用されません。
ワークアラウンド
この問題に対処するには、Web.config
ファイルからConfigurationManagerを使用してライセンスキーを取得し、それをLicense.LicenseKeyプロパティに適用することをお勧めします。
例:
<configuration>
...
<appSettings>
<add key="IronOcr.LicenseKey" value="IRONOCR-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronOcr.LicenseKey" value="IRONOCR-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
上記のXMLファイルを使用して、ConfigurationManagerを利用してライセンスキーの値を取得し、IronOcr.License.LicenseKeyプロパティに渡すことができます。
using System.Configuration;
string licenseKey = ConfigurationManager.AppSettings ["IronOcr.LicenseKey"];
IronOcr.License.LicenseKey = licenseKey;
using System.Configuration;
string licenseKey = ConfigurationManager.AppSettings ["IronOcr.LicenseKey"];
IronOcr.License.LicenseKey = licenseKey;
Imports System.Configuration
Private licenseKey As String = ConfigurationManager.AppSettings ("IronOcr.LicenseKey")
IronOcr.License.LicenseKey = licenseKey