web.config에서 IronXL 라이선스 구성 (C#)
해당 문제는 IronXL 버전 2024.3.20 부터 해결 되었습니다.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronXL must be licensed for development.
IronXL 구버전, 특히 2023.4.13 버전과 2024.3.20 버전 사이에는 다음과 같은 라이선스 문제가 있는 것으로 알려져 있습니다.
- ASP.NET 프로젝트
-
.NET Framework 버전 4.6.2 이상
Web.config파일에 저장된 키는 제품에 사용되지 않습니다.
해결 방법
이 문제를 해결하기 위해, 코드에서 ConfigurationManager를 사용하여 Web.config 파일에서 라이선스 키를 검색하고 이를 License.LicenseKey 속성에 적용하는 것이 권장됩니다.
예:
아래는 Web.config 파일에 라이선스 키를 저장하는 방법의 예시입니다:
<configuration>
...
<appSettings>
<add key="IronXL.LicenseKey" value="IronXL-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronXL.LicenseKey" value="IronXL-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
위의 XML 파일 설정을 통해 ConfigurationManager를 사용하여 라이선스 키 값을 검색하고 이를 IronXL.License.LicenseKey 속성에 설정할 수 있습니다:
using System.Configuration;
// Retrieve the license key from the Web.config appSettings section
string licenseKey = ConfigurationManager.AppSettings["IronXL.LicenseKey"];
// Apply the retrieved license key to the IronXL component
IronXL.License.LicenseKey = licenseKey;
using System.Configuration;
// Retrieve the license key from the Web.config appSettings section
string licenseKey = ConfigurationManager.AppSettings["IronXL.LicenseKey"];
// Apply the retrieved license key to the IronXL component
IronXL.License.LicenseKey = licenseKey;
Imports System.Configuration
' Retrieve the license key from the Web.config appSettings section
Private licenseKey As String = ConfigurationManager.AppSettings("IronXL.LicenseKey")
' Apply the retrieved license key to the IronXL component
IronXL.License.LicenseKey = licenseKey
이 예에서는 ConfigurationManager.AppSettings 를 사용하여 IronXL.LicenseKey 의 값을 Web.config 에서 검색합니다. 검색된 라이선스 키는 IronXL.License.LicenseKey 에 설정되어 IronXL 구성 요소가 제대로 작동할 수 있도록 합니다.

