Web.co/nfig에서 라이선스 키 설정
이 문제는 IronOCR 버전 2024.3.4부터 해결되었습니다.
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.co/nfig 파일에 저장된 키는 제품에서 인식하거나 사용하지 않습니다.
대안
이 문제를 해결하려면 코드 내에서 ConfigurationManager를 사용하여 Web.co/nfig 파일에서 라이선스 키를 가져온 다음, 이를 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.Co/nfiguration;
// Retrieve the license key from the Web.co/nfig's appSettings
string licenseKey = ConfigurationManager.AppSettings["IronOcr.LicenseKey"];
// Apply the license key to IronOcr to avoid licensing exceptions
IronOcr.License.LicenseKey = licenseKey;
using System.Co/nfiguration;
// Retrieve the license key from the Web.co/nfig's appSettings
string licenseKey = ConfigurationManager.AppSettings["IronOcr.LicenseKey"];
// Apply the license key to IronOcr to avoid licensing exceptions
IronOcr.License.LicenseKey = licenseKey;
Imports System.Configuration
' Retrieve the license key from the Web.config's appSettings
Dim licenseKey As String = ConfigurationManager.AppSettings("IronOcr.LicenseKey")
' Apply the license key to IronOcr to avoid licensing exceptions
IronOcr.License.LicenseKey = licenseKey

