Rotativa crashes on service fabric node in Azure

0

I have a project that needs to collect several data and put it in a single pdf, to do so I used Rotativa wrapper. 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. The problem comes when I deployed the project in Azure (service fabric cluster) and Im getting this error:

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)
    • Moved the Rotativa folder from wwwroot to the root path of the project and set the path in RotativaConfiguration.Setup() method
    • Copied msvcp120.dll and msvcr120.dll to the Rotativa folder
    • Installed wkhtmltopdf.exe in the service fabric node
    • I installed Rotativa.AspNetCore 1.0.6 nuget package
    • I use ViewAsPdf to render the razor view and I call BuildFile method to get the byte array
    • 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"

The service fabric node is a Windows machine. The project is built with aspnet core 2.0 Any help will be appreciated. Thanks!

c#
azure
azure-service-fabric
rotativa
asked on Stack Overflow Jun 26, 2018 by marsalal1014

2 Answers

1

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 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.
answered on Stack Overflow Jun 27, 2018 by Diego Mendes
0

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.

answered on Stack Overflow Jun 27, 2018 by LoekD

User contributions licensed under CC BY-SA 3.0