웹 구성 파일(web.config)에서 IronOCR 라이선스 설정
문제는 IronZIP 버전 2024.3.3부터 해결되었습니다.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronZip must be licensed for development.
이전 IronZIP 버전, 특히 2024.3.3 이전 버전에 대해서는 다음과 같은 라이선스 문제가 있는 것으로 알려져 있습니다.
- ASP.NET 프로젝트
- .NET Framework 버전 4.6.2 이상
제품에서 파일 Web.config에 저장된 키는 사용되지 않습니다.
해결 방법
이 문제를 해결하기 위해, 코드에서 ConfigurationManager를 사용하여 Web.config 파일에서 라이선스 키를 가져온 다음, License.LicenseKey 속성에 적용하는 것이 추천됩니다.
예:
<configuration>
...
<appSettings>
<add key="IronZip.LicenseKey" value="IRONZIP.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronZip.LicenseKey" value="IRONZIP.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
위에서 제공된 XML 파일을 사용하면 ConfigurationManager를 통해 라이선스 키 값을 가져와 IronZip.License.LicenseKey 속성에 전달할 수 있습니다.
using System;
using System.Configuration;
class Program
{
static void Main()
{
// Retrieve the license key from the web.config appSettings
string licenseKey = ConfigurationManager.AppSettings["IronZip.LicenseKey"];
// Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey;
// Verify that the license key is set properly
Console.WriteLine("License key applied successfully.");
}
}
using System;
using System.Configuration;
class Program
{
static void Main()
{
// Retrieve the license key from the web.config appSettings
string licenseKey = ConfigurationManager.AppSettings["IronZip.LicenseKey"];
// Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey;
// Verify that the license key is set properly
Console.WriteLine("License key applied successfully.");
}
}
Imports System
Imports System.Configuration
Friend Class Program
Shared Sub Main()
' Retrieve the license key from the web.config appSettings
Dim licenseKey As String = ConfigurationManager.AppSettings("IronZip.LicenseKey")
' Apply the license key to IronZip
IronZip.License.LicenseKey = licenseKey
' Verify that the license key is set properly
Console.WriteLine("License key applied successfully.")
End Sub
End Class
using System.Configuration;지시는Web.config과 같은 구성 파일에 접근할 수 있게 합니다.ConfigurationManager.AppSettings["IronZip.LicenseKey"]은/는Web.config의appSettings섹션에 저장된 라이선스 키를 가져옵니다.IronZip.License.LicenseKey = licenseKey;은/는 라이센싱 예외를 방지하기 위해 가져온 키를 IronZip 라이브러리에 할당합니다.Console.WriteLine()문은 개발자에게 라이선스 키 적용 프로세스가 성공적으로 완료되었음을 피드백합니다.

