Clé de licence IronWebScraper pour ASP.NET
Le problème a été résolu à partir de la version 2024.3.6 d'IronWebScraper.
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronWebScraper must be licensed for development.
Pour les anciennes versions d'IronWebScraper, notamment celles comprises entre les versions 2023.4.13 et 2024.3.6 , il existe un problème de licence connu :
- projets ASP.NET
- version .NET Framework >= 4.6.2
La clé stockée dans un fichier Web.config ne sera PAS détectée ni utilisée par le produit.
Solution de contournement
Pour résoudre ce problème, il est recommandé de récupérer la clé de licence à partir du fichier Web.config en utilisant ConfigurationManager dans le code, puis de l'appliquer à la propriété License.LicenseKey.
Exemple :
<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>
Avec le fichier XML fourni ci-dessus, nous pouvons utiliser ConfigurationManager pour récupérer la valeur de la clé de licence et la transmettre à la propriété IronWebScraper.License.LicenseKey .
// Retrieve the license key from the appSettings section of the Web.config 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.
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

