Search code examples
asp.netasp.net-mvcwkhtmltopdfrotativa

Rotativa 1.6.1 gives "Untested Windows version 6.2 detected!" message as an exception


I have a webserver running multiple versions of the same site. The live site works fine. The test site throws a "Untested Windows version 6.2 detected!" error when I try to generate a PDF. Copying over the Rotativa folder from the working live site to the test site does't help. Upgrading to a newer version of Rotativa gives me other problems that are not on the list to solve right now (we're contemplating on moving away from it actually).

I have the feeling it's not code related but it has to do with permissions, but I couldn't find any way to get it to work. For sake of completeness, here's the stack:

[Exception: Qt: Untested Windows version 6.2 detected!
Error: Failed loading page http://test.mysite.com/Home/PrintBackorderView (sometimes it will work just to ignore this error with --load-error-handling ignore)
]
   Rotativa.WkhtmltopdfDriver.Convert(String wkhtmltopdfPath, String switches, String html) +793
   Rotativa.AsPdfResultBase.CallTheDriver(ControllerContext context) +31
   Rotativa.AsPdfResultBase.BuildPdf(ControllerContext context) +186
   Web.Application.Controllers.HomeController.AddBackordersToPDF(PdfDocument pdfDocument) +188
   Web.Application.Controllers.HomeController.Process() +2681
   lambda_method(Closure , ControllerBase , Object[] ) +79
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +242
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39
   System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +12
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +139
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +112
   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +452
   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +15
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +37
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +241
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +19
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +51
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

Solution

  • Rotativa is sort of a wrapper around the old Nokia browser, that loads the page you create and renders it to PDF. Apparently this software sometimes needs some help sometimes to resolve the address of the contant it needs to parse, so I added the domain to the HOSTS file.

    http://support.hostgator.com/articles/general-help/technical/how-do-i-change-my-hosts-file

    # this should contain the URLs it needs to use
    123.45.67.89 www.example.com