You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Web App部署IronPdf触发IronSoftwareDeploymentException异常求助

问题:Azure Web App部署IronPdf HTML转PDF功能失败(.NET Framework 4.8)

将基于.NET Framework 4.8的HTML转PDF功能部署到Azure Web App后,抛出IronSoftware.Exceptions.IronSoftwareDeploymentException异常,本地运行正常。

错误日志

IronSoftware.Exceptions.IronSoftwareDeploymentException: Error while deploying IronPdf Chrome renderer: 'Unable to locate 'IronInterop' in C:\home\site\wwwroot\, C:\home\site\wwwroot\bin, C:\local\Temporary ASP.NET Files\root\26df21a6\54e3e732\assembly\dl3\9559295f\001eed5d_d423d901, C:\home\site\wwwroot, Embedded resource (IronPdf, Version=2023.1.0.11416, Culture=neutral, PublicKeyToken=94e1c31412563c75: IronPdf) to path 'C:\home\site\wwwroot\runtimes\win-x64\native', Embedded resource (IronPdf, Version=2023.1.0.11416, Culture=neutral, PublicKeyToken=94e1c31412563c75: IronPdf) to path 'C:\home\site\wwwroot\runtimes\win.10-x64\native', Embedded resource (IronPdf, Version=2023.1.0.11416, Culture=neutral, PublicKeyToken=94e1c31412563c75: IronPdf) to path 'C:\home\site\wwwroot\' nor in an embedded resource'. To learn more about making an engineering support request please visit: <a href=https://ironpdf.com/troubleshooting/engineering-request-pdf/>.
To learn how to solve this issue please read https://iron.helpscoutdocs.com/article/194-azure-functions-deployment2 
[Issue Code IRONPDF-CHROME-DEPLOYMENT-ERROR-AMZN] ---> IronSoftware.Exceptions.IronSoftwareDeploymentException: 
Unable to locate 'IronInterop' in C:\home\site\wwwroot\, C:\home\site\wwwroot\bin, C:\local\Temporary ASP.NET Files\root\26df21a6\54e3e732\assembly\dl3\9559295f\001eed5d_d423d901,
 C:\home\site\wwwroot, Embedded resource (IronPdf, Version=2023.1.0.11416, Culture=neutral, PublicKeyToken=94e1c31412563c75: IronPdf) to path 'C:\home\site\wwwroot\runtimes\win-x64\native', 
 Embedded resource (IronPdf, Version=2023.1.0.11416, Culture=neutral, PublicKeyToken=94e1c31412563c75: IronPdf) 
 to path 'C:\home\site\wwwroot\runtimes\win.10-x64\native', Embedded resource (IronPdf, Version=2023.1.0.11416, Culture=neutral, PublicKeyToken=94e1c31412563c75: IronPdf) 
 to path 'C:\home\site\wwwroot\' nor in an embedded resourceat IronSoftware.Deployment.SmartDeploymentBase.ThrowRelevantException(List`1 exceptions)at
 IronSoftware.Deployment.SmartDeploymentBase.Deploy(Boolean download)at IronSoftware.Deployment.DeploymentEngine.Deploy[T](String custom_dir, Boolean download)--- 
 End of inner exception stack trace

已执行操作

  • 已添加NuGet依赖包IronPdf.Native.Chrome.Windows
  • 核心渲染代码:
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.RenderDelay = Convert.ToInt32(SiteSettingsPage.Settings.PDFRenderDelay);
renderer.RenderingOptions.MarginTop = 12;
renderer.RenderingOptions.MarginBottom = 12;
renderer.RenderingOptions.MarginLeft = 0;
renderer.RenderingOptions.MarginRight = 0;
renderer.RenderingOptions.PaperOrientation = IronPdf.Rendering.PdfPaperOrientation.Portrait;
renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A4;
var pdf = renderer.RenderUrlAsPdf(htmlFileUrl).BinaryData;

解决方案

  • 确认Native包部署状态
    检查Azure Web App的wwwroot/runtimes/win-x64/native目录下是否存在IronInterop.dll。若缺失,在项目中找到IronPdf.Native.Chrome.Windows包的相关文件,设置“复制到输出目录”为“始终复制”,重新部署。
  • 配置Azure运行环境
    确保Azure Web App运行栈为Windows,平台位数设置为64位(在Azure门户“配置”>“常规设置”中调整)。
  • 手动上传Native资源
    若自动部署丢失文件,将本地项目输出目录下的runtimes文件夹,通过Azure门户的Kudu工具或FTP上传到Web App的wwwroot目录。
  • 指定资源路径
    在初始化ChromePdfRenderer前添加配置,明确native资源位置:
    IronPdf.Installation.LinuxAndWindowsDependenciesAutoConfig = false;
    IronPdf.Installation.SetCustomDeploymentDirectory(Server.MapPath("~/runtimes/win-x64/native"));
    
  • 检查目录权限
    确保Web App的应用服务计划拥有wwwroot目录的读写权限,避免资源文件无法被读取或写入。

内容的提问来源于stack exchange,提问作者ctor

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 03:47:53