Rotativa PDF生成失败和Web场

时间:2017-05-17 00:06:20

标签: asp.net-mvc pdf rotativa

我在网站的不同部分使用ViewAsPDF和ActionAsPDF方法,并将代码部署到我们的生产服务器。当我访问单个服务器IP地址然后按预期打印PDF,但是当我使用在服务器之间进行负载平衡的URL时,PDF功能失败并出现以下错误:

Exception information:
    Exception type: Exception
    Exception message: Error: Failed loading page http://example.com/PDF (sometimes it will work just to ignore this error with --load-error-handling ignore)
Exit with code 1 due to network error: UnknownNetworkError

   at Rotativa.WkhtmltopdfDriver.Convert(String wkhtmltopdfPath, String switches, String html)
   at Rotativa.WkhtmltopdfDriver.Convert(String wkhtmltopdfPath, String switches)
   at Rotativa.AsPdfResultBase.CallTheDriver(ControllerContext context)
   at Rotativa.AsPdfResultBase.BuildPdf(ControllerContext context)
   at Rotativa.AsPdfResultBase.ExecuteResult(ControllerContext context)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

PDF生成的常见解决方案是将msvcp120.dll和msvcr120.dll文件添加到与wkhtmltopdf.exe相同的文件夹中,但这没有什么区别。

0 个答案:

没有答案