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
Dim licenseKey As String = ConfigurationManager.AppSettings("IronXl.LicenseKey")
' Apply the retrieved license key to the IronXL component
IronXl.License.LicenseKey = licenseKey
이 예제에서 ConfigurationManager.AppSettings은 Web.config에서 IronXl.LicenseKey의 값을 가져오는 데 사용됩니다. 그런 다음 검색된 라이선스 키를 IronXl.License.LicenseKey로 설정하여 IronXL 구성 요소가 정상적으로 작동하도록 합니다.

