ASP.NET構成内のIronWordライセンスキー

This article was translated from English: Does it need improvement?
Translated
View the article in English

この問題はIronWordバージョン2024.3.5解決されました。

Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronWord must be licensed for development.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronWord must be licensed for development.
SHELL

古いバージョンのIronWord、特にバージョン2024.3.5以前にリリースされたものには、以下のライセンス問題が知られています:

  • ASP.NET プロジェクト
  • .NET Framework バージョン >= 4.6.2

    Web.config ファイルに保存されたキーは、製品によって使用されません

ワークアラウンド

この問題に対処するには、Web.configファイルからConfigurationManagerを使用してライセンスキーを取得し、それをLicense.LicenseKeyプロパティに適用することをお勧めします。

例:

<configuration>
...
  <appSettings>
    <add key="IronWord.LicenseKey" value="IRONWORD.MYLICENSE.KEY.1EF01"/>
  </appSettings>
...
</configuration>
<configuration>
...
  <appSettings>
    <add key="IronWord.LicenseKey" value="IRONWORD.MYLICENSE.KEY.1EF01"/>
  </appSettings>
...
</configuration>
XML

上記のXMLファイルを使用して、ConfigurationManager を使ってライセンスキーの値を取得し、それを IronWord.License.LicenseKey プロパティに渡すことができます。

using System.Configuration;

string licenseKey = ConfigurationManager.AppSettings ["IronWord.LicenseKey"];

IronWord.License.LicenseKey = licenseKey;
using System.Configuration;

string licenseKey = ConfigurationManager.AppSettings ["IronWord.LicenseKey"];

IronWord.License.LicenseKey = licenseKey;
Imports System.Configuration

Private licenseKey As String = ConfigurationManager.AppSettings ("IronWord.LicenseKey")

IronWord.License.LicenseKey = licenseKey
$vbLabelText   $csharpLabel