IronWebScraper ASP.NET 授權金鑰
Curtis Chau
已更新: 2025年6月11日
此問題已在IronWebScraper版本2024.3.6中解決。
Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronWebScraper must be licensed for development.
Text
對於舊版本的IronWebScraper,特別是版本2023.4.13至2024.3.6之間,已知存在授權問題於:
- ASP.NET項目
- .NET Framework 版本 >= 4.6.2
存儲在Web.config檔案中的金鑰將不會被產品檢測到並使用。
解決方法
為了解決此問題,建議從Web.config檔案中使用ConfigurationManager在程式碼中檢索授權金鑰,然後將其應用到License.LicenseKey屬性。
例子:
<configuration>
...
<appSettings>
<add key="IronWebScraper.LicenseKey" value="IRONWEBSCRAPER-MYLICENSE-KEY-1EF01"/>
</appSettings>
...
</configuration>
XML
使用上面提供的 XML 文件,我們可以使用ConfigurationManager檢索許可證金鑰值並將其傳遞給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.
Dim licenseKey As String = 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 = licenseKeyCurtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。