简体   繁体   中英

Rotativa pdf not working after deploying to IIS on server

I'm using Rotativa for converting html to pdf on my asp.net mvc website. It works fine locally, but after I deploy on the server, it just returns a text saying "Rotativa.ViewAsPdf", that is the method name I'm calling in my C# code. There's no exception/errors, nothing in the logs and event viewer.

I have given full permissions to wkhtmltodf.exe, the Rotativa folder too. There's also Rotativa.dll present inside the bin directory. Also, I have installed MSCVP120.dll on the server, but I'm not able to figure out what could be the problem. Please help.

Found the solution! :) Thanks https://stackoverflow.com/a/21690696/1542798

I'm using System.Web.Mvc 5.2.3, so I had to change the binding redirect in my web.config form 5.0.0 to 5.2.3

<dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
    <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.2.3.0"/>
  </dependentAssembly>

c:\\inetpub\\wwwroot\\DummyProject\\Rotativa\\wkhtmltopdf.exe d:\\Pdf\\Dummy.html d:\\Pdf\\Dummy.pdf

you can try to run this line on the cmd to check the problem

replace the "c:\\" path with the project path and the HTML path with any of your HTML files and the pdf path with any place you want to replace your path

this will make you check what's the problem

in my case there's missing ddls that required to be installed "msvcp120.dll"

if it's the same problem with you, you can check these steps to solve it

https://www.smarterasp.net/support/kb/a1702/sample-process-to-generate-pdf-with-rotativa-in-asp_net-mvc.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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