简体   繁体   English

Rotativa在Azure中的服务结构节点上崩溃

[英]Rotativa crashes on service fabric node in Azure

I have a project that needs to collect several data and put it in a single pdf, to do so I used Rotativa wrapper. 我有一个项目需要收集多个数据并将其放入单个pdf中,因此我使用了Rotativa包装器。 It works fine on my local service fabric cluster and Im able to generate the pdf using ViewAsPdf and then getting the byte array to attach it in an email. 它在我的本地服务结构集群上运行良好,并且能够使用ViewAsPdf生成pdf,然后获取字节数组以将其附加到电子邮件中。 The problem comes when I deployed the project in Azure (service fabric cluster) and Im getting this error: 当我在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 ---

Things that Ive tried: 我尝试过的事情:

  • Installed Visual C++ Redistributable Packages for Visual Studio 2013 and 2015 in x64 and x86 versions in the service fabric node (where the project is being deployed) 在服务结构节点(部署项目的地方)中以x64和x86版本安装了Visual Studio 2013和2015的Visual C ++可再发行组件包
    • Moved the Rotativa folder from wwwroot to the root path of the project and set the path in RotativaConfiguration.Setup() method 将Rotativa文件夹从wwwroot移到项目的根路径,并在RotativaConfiguration.Setup()方法中设置路径
    • Copied msvcp120.dll and msvcr120.dll to the Rotativa folder 将msvcp120.dll和msvcr120.dll复制到Rotativa文件夹
    • Installed wkhtmltopdf.exe in the service fabric node 在服务结构节点中安装了wkhtmltopdf.exe
    • I installed Rotativa.AspNetCore 1.0.6 nuget package 我安装了Rotativa.AspNetCore 1.0.6 nuget包
    • I use ViewAsPdf to render the razor view and I call BuildFile method to get the byte array 我使用ViewAsPdf渲染剃刀视图,并调用BuildFile方法获取字节数组
    • If I ran the wkhtmltopdf.exe in the command line in the service fabric node I get: "The application was unable to start correctly(0xc000007b) Click ok to close the application" 如果我在服务结构节点的命令行中运行了wkhtmltopdf.exe,则会得到:“应用程序无法正确启动(0xc000007b),单击“确定”以关闭应用程序”

The service fabric node is a Windows machine. 服务结构节点是Windows计算机。 The project is built with aspnet core 2.0 Any help will be appreciated. 该项目使用aspnet core 2.0构建。任何帮助将不胜感激。 Thanks! 谢谢!

I assume is a missing dependency issue. 我认为这是一个缺少的依存关系问题。

Based on the scenario and message you provided The application was unable to start correctly(0xc000007b) there are other related problems: The application was unable to start correctly (0xc000007b) and Error : the application was unable to start correctly 根据您提供的方案和消息The application was unable to start correctly(0xc000007b)还有其他相关问题: 应用程序无法正确启动(0xc000007b)错误:应用程序无法正确启动

The other issue might be lack of permissions to run or access specific dependencies. 另一个问题可能是缺少运行或访问特定依赖项的权限。

I would suggest you try: 我建议您尝试:

  • running as administrator first via command line. 首先通过命令行以管理员身份运行。
  • Check firewall or network\\website permissions 检查防火墙或网络\\网站权限
  • Use dependency walker and check the dependencies it loads\\fail and verify if they are installed on the server. 使用依赖项遍历器并检查其加载的依赖项\\失败,并验证它们是否已安装在服务器上。

As a workaround you could create a container to run this. 作为解决方法,您可以创建一个容器来运行它。 It would save you the trouble of going into the nodes to install stuff, which limits your scale out & fail-over options. 这将避免您进入节点安装内容的麻烦,从而限制了横向扩展和故障转移选项。

There are some people who got it working . 有些人 使它起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM