Rotativa-ViewAspdf在服务器上不起作用 [英] Rotativa - ViewAspdf does not work on server

查看:84
本文介绍了Rotativa-ViewAspdf在服务器上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道已经在几篇文章中讨论了这个主题,但是没有一种解决方案对我有帮助.

I know that this topic has been discuss on several articles, but none of the solution help me.

我有这个动作:

   public ActionResult DownloadViewPDF(string userId)
        {
            var model = db.MyCvs.FirstOrDefault(u => u.UserId == userId);

            if (model != null)
                return new Rotativa.ViewAsPdf("ViewUserCv", model) { FileName = model.FirstName + model.LastName + "_CV.pdf" };
            return Content("there is no Cv to download");
        }

使用上述操作,我正在下载一个pdf格式的视图,并且一切正常运行在我的计算机上.

Using the above action I am downloading a view as pdf, and everything is working as expected on my computer.

在服务器上部署项目后,此操作不起作用,返回错误:

After deploying the project on the server, this action is not working, is returning an error:

在执行过程中生成了未处理的异常当前的Web请求.有关原产地和位置的信息可以使用异常堆栈跟踪来识别异常在下面.

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

我正在使用Visual Studio Community 2015.在服务器上,我有 Rotativa.dll ,还有根目录中名为Rotativa的Folder,其中的文件名为 wkhtmltopdf.exe .

I am using Visual Studio Community 2015. On the server I have the Rotativa.dll and also the Folder in the root directory named Rotativa with the file inside named wkhtmltopdf.exe.

我不知道该如何处理该错误,您能不能给我一些建议?

I do not know how to handle this error, can you give me some sugestions?

推荐答案

我找到了一个非常简单的教程,该教程如何解决Rotativa的问题,对于那些具有相同问题的人,请遵循此教程:

I found a very simple tutorial how to fix my issue with rotativa, for those which have the same issue, please follow this tutorial:

根据本教程,我们要做的只是:

based on this tutorial, all we need to do is to:

上传dll:

  • msvcp120.dll
  • msvcr120.dll

因为Rotativa需要"Visual Studio的Visual C ++可再发行组件"组件.

because Rotativa need component of "Visual C++ Redistributable for Visual Studio".

C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ Common7 \ Packages \ Debugger \ X64 \ msvcp120.dll

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Packages\Debugger\X64\msvcp120.dll

C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ Common7 \ Packages \ Debugger \ X64 \ msvcr120.dll

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Packages\Debugger\X64\msvcr120.dll

您可以使用您自己的指定路径引用本地路径上的上述路径找到它.将它们上传到"Rotativa"文件夹.

You can refer above path on your local with your own specified path to find it. Upload them to "Rotativa" folder.

这篇关于Rotativa-ViewAspdf在服务器上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆