【发布时间】:2018-12-05 17:27:22
【问题描述】:
我有一个项目需要收集多个数据并将其放入一个 pdf 文件中,为此我使用了 Rotativa 包装器。它在我的本地服务结构集群上运行良好,我能够使用 ViewAsPdf 生成 pdf,然后获取字节数组以将其附加到电子邮件中。当我在 Azure(服务结构集群)中部署项目并收到此错误时出现问题:
at Rotativa.AspNetCore.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html, String wkhtmlExe)\r\n at Rotativa.AspNetCore.WkhtmltopdfDriver.ConvertHtml(String wkhtmltopdfPath, String switches, String html)\r\n at Rotativa.AspNetCore.ViewAsPdf.<CallTheDriver>d__19.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---
我尝试过的事情:
- 在服务结构节点(正在部署项目的位置)中为 Visual Studio 2013 和 2015 安装了 x64 和 x86 版本的 Visual C++ Redistributable Packages
- 将 Rotativa 文件夹从 wwwroot 移动到项目的根路径,并在 RotativaConfiguration.Setup() 方法中设置路径
- 将 msvcp120.dll 和 msvcr120.dll 复制到 Rotativa 文件夹中
- 在服务结构节点中安装了 wkhtmltopdf.exe
- 我安装了 Rotativa.AspNetCore 1.0.6 nuget 包
- 我使用 ViewAsPdf 渲染剃刀视图,并调用 BuildFile 方法获取字节数组
- 如果我在 Service Fabric 节点的命令行中运行 wkhtmltopdf.exe,我会得到:“应用程序无法正确启动 (0xc000007b) 单击确定关闭应用程序”
Service Fabric 节点是一台 Windows 机器。该项目使用aspnet core 2.0构建 任何帮助将不胜感激。谢谢!
【问题讨论】:
标签: c# azure azure-service-fabric rotativa