IronPDF 故障排除 使用ReadyToRun Use ReadyToRun or Ahead-Of-Time (AOT) Compilation Curtis Chau 已更新:六月 1, 2025 Download IronPDF NuGet 下载 DLL 下载 Windows 安装程序 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article This article was translated from English: Does it need improvement? Translated View the article in English .NET ReadyToRun (R2R) 是一种预先(AOT)编译形式。 在部署期间启用 ReadyToRun 编译可能会违反篡改保护,并导致以下异常情况: Exception: Unhandled exception. IronSoftware.Exceptions.LicensingException: IronPdf, Version=2024.2.0.2, Culture=neutral, PublicKeyToken=94e1c31412563c75 assembly is not authentic. Please try to reinstall the nuget package at IronPdf.PdfDocument.uswvws(Boolean vhfwdf) at IronPdf.PdfDocument.get_BinaryData() at IronPdf.PdfDocument.SaveAs(String FileName, Boolean SaveAsRevision) at Program.<Main>(String[] args) in C:\csharppro\aottest\aottest\Program.cs:line 5 原因 根据微软文档,SDK 会预编译与应用程序一起分发的程序集。 对于自包含应用程序,这组程序集将包括框架。 重要的是要注意,C++/CLI 二进制文件不适合 ReadyToRun 编译。 解决方案 要从 ReadyToRun 处理中排除特定程序集,请在项目文件中使用 <PublishReadyToRunExclude> 列表。例如,要排除 IronPdf.dll 程序集: <ItemGroup> <!-- Excludes IronPdf.dll from ReadyToRun compilation --> <PublishReadyToRunExclude Include="IronPdf.dll" /> </ItemGroup> <ItemGroup> <!-- Excludes IronPdf.dll from ReadyToRun compilation --> <PublishReadyToRunExclude Include="IronPdf.dll" /> </ItemGroup> XML 此 XML 代码片段应添加到您的项目文件(.csproj)中,以防止指定的程序集被 ReadyToRun 预编译,从而避免潜在的许可或篡改问题。 Curtis Chau 立即与工程团队聊天 技术作家 Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。 准备开始了吗? Nuget 下载 16,154,058 | 版本: 2025.11 刚刚发布 免费 NuGet 下载 总下载量:16,154,058 查看许可证