Klucz licencyjny IronWebscraper dla ASP.NET
Problem został rozwiązany w wersji IronWebscraper 2024.3.6.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronWebScraper must be licensed for development.
W przypadku starszych wersji IronWebscraper, a konkretnie tych z zakresu od 2023.4.13 do 2024.3.6, występuje znany problem licencyjny w:
- Projekty ASP.NET
- .NET Framework w wersji >= 4.6.2
Klucz zapisany w pliku Web.co/nfig NIE zostanie pobrany i wykorzystany przez produkt.
Rozwiązanie
Aby rozwiązać ten problem, zaleca się pobranie klucza licencyjnego z pliku Web.co/nfig za pomocą ConfigurationManager w kodzie, a następnie zastosowanie go do właściwości License.LicenseKey.
Przykład:
<configuration>
...
<appSettings>
<add key="IronWebScraper.LicenseKey" value="IRONWEBSCRAPER-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
<configuration>
...
<appSettings>
<add key="IronWebScraper.LicenseKey" value="IRONWEBSCRAPER-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
Korzystając z pliku XML podanego powyżej, możemy użyć ConfigurationManager do pobrania wartości klucza licencyjnego i przekazania go do właściwości IronWebScraper.License.LicenseKey.
// Retrieve the license key from the appSettings section of the Web.co/nfig file.
string licenseKey = ConfigurationManager.AppSettings["IronWebScraper.LicenseKey"];
// Assign the license key to the IronWebScraper's LicenseKey property.
IronWebScraper.License.LicenseKey = licenseKey;
// Retrieve the license key from the appSettings section of the Web.co/nfig file.
string licenseKey = ConfigurationManager.AppSettings["IronWebScraper.LicenseKey"];
// Assign the license key to the IronWebScraper's LicenseKey property.
IronWebScraper.License.LicenseKey = licenseKey;
' Retrieve the license key from the appSettings section of the Web.config file.
Dim licenseKey As String = ConfigurationManager.AppSettings("IronWebScraper.LicenseKey")
' Assign the license key to the IronWebScraper's LicenseKey property.
IronWebScraper.License.LicenseKey = licenseKey

