更新 2024年十月20日
IronPrint许可配置故障排除
This article was translated from English: Does it need improvement?
TranslatedView the article in English
The problem has been resolved as of IronPrint version 2024.3.6.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPrint must be licensed for development.
对于旧版本的 IronPrint,特别是在版本2024.3.6, 在以下内容中存在已知的许可问题:
- ASP.NET 项目
.NET Framework 版本 >= 4.6.2
存储在
Web.config
文件中的密钥将不会被产品拾取并使用。
变通方法
为了解决此问题,建议在代码中使用 ConfigurationManager 从 Web.config
文件中检索许可证密钥,然后将其应用到 License.LicenseKey 属性。
示例:
<configuration>
...
<appSettings>
<add key="IronPrint.LicenseKey" value="IRONPRINT.MYLICENSE.KEY.1EF01"/>
</appSettings>
...
</configuration>
XML
有了上面提供的 XML 文件,我们就可以使用 ConfigurationManager 来获取许可证密钥值,并将其传递给 IronPrint.License.LicenseKey 属性。
using System.Configuration;
string licenseKey = ConfigurationManager.AppSettings ["IronPrint.LicenseKey"];
IronPrint.License.LicenseKey = licenseKey;
using System.Configuration;
string licenseKey = ConfigurationManager.AppSettings ["IronPrint.LicenseKey"];
IronPrint.License.LicenseKey = licenseKey;
Imports System.Configuration
Private licenseKey As String = ConfigurationManager.AppSettings ("IronPrint.LicenseKey")
IronPrint.License.LicenseKey = licenseKey
$vbLabelText $csharpLabel