6

I am using Rotativa ActionasPDF() to generate a pdf from a view in my MVC4 project. It works flawlessly on my local instance, but I just copied the entire solution to my server and it does not work. I get the error "The system cannot find the file specified", but I'm not sure what file it is talking about. I assume it is talking about the Rotativa dll, but I've got the generated Rotativa folder on my server as well. The solution is an exact duplicate as my local copy. My site is hosted on IIS 8, windows 2012 server. Research has told me I could have a permissions issue with some folder, but I'm not sure which ones they would be. I just set all my controller & views to 777 permissions for the time being. No luck. Any ideas to what I'm missing, or how I can make sure the dll is registered on my server?

Here is my controller action method:

public ActionResult DownloadFile(int id = 0)
    {
        var filename = string.Format("Invoice{0}.pdf", id);

        return new ActionAsPdf("Invoice" + "/" + id, new { name = "Invoice" + id }) { FileName = filename, PageSize = Size.Letter, PageOrientation = Orientation.Portrait, PageMargins = new Margins(0, 0, 0, 0) };
    }

enter image description here

4

4 回答 4

1

检查是否在服务器上的 rotativa 目录中添加所有文件-

libeay32.dll

wkhtmltopdf.exe

等等

于 2016-10-10T12:44:21.843 回答
1

旧线程,但我遇到了同样的问题,所以我想为将来搜索的人分享解决方案。

确保您在服务器上安装了正确的 VS Redistributable,或者在 Rotativa 文件夹中安装了文件。

使用服务器 IP 地址而不是 DNS 名称。我不知道为什么会这样,但如果我弄明白了会编辑它。

于 2017-11-20T20:20:11.067 回答
0

您需要在服务器上安装 Visual C++ Redistributable Packages。您可以从这里下载软件包:http: //www.microsoft.com/en-gb/download/details.aspx?id=40784

于 2015-03-05T10:21:06.800 回答
-1

您需要在 Nuget 中更新 Rotativa、Rotativa.Core、Rotativa.MVC

于 2018-11-20T14:02:09.953 回答