简体   繁体   中英

Generating PDF with Rotativa throws error after moving to new server

I use Rotativa's ActionAsPdf method to convert HTML files to PDF. (Nuget Rotativa 1.7.3)

[ValidateInput(false)]
public ActionResult PrintReport(string EvalId, string ApplicationID, bool SsOnly, bool Pdf, string ApplicantName)
{
    try
    {
        string FileName = ApplicantName.Trim().Replace(" ", "_") + "_results.pdf";

        return new ActionAsPdf("Report", new { EvalId, ApplicationID, SsOnly, PDF = true }) { FileName = FileName };

    }
    catch (Exception ex)
    {
        Errors.ErrorOccured(ex);
    }
    return RedirectToAction("Index", "Error", new { Area = "" });
}

This has worked great so far. We are in the process of replacing the web server with a newer one.

This worked fine until we moved this to the new server. At first I thought it wasn't working because the site had been moved over to the new server by just moving the files. So I then did a publish to the new server, and still have the same error.

Here is what the stacktrace says

[Exception]
Rotativa.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html, String wkhtmlExe) +1037
Rotativa.WkhtmltopdfDriver.Convert(String wkhtmltopdfPath, String switches) +72
Rotativa.AsPdfResultBase.WkhtmlConvert(String switches) +80
Rotativa.AsResultBase.CallTheDriver(ControllerContext context) +100
Rotativa.AsResultBase.BuildFile(ControllerContext context) +306
Rotativa.AsResultBase.ExecuteResult(ControllerContext context) +67
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +88
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81
System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult) +188
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +26
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +39
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +40
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +602
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128

I can see it is pointing to the Rotativa but do not know what the issue is. any ideas?

It turns out we needed msvcp140.dll and vcruntime140.dll copied into Windows>SysWOW64

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