首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >rotativa不在SSL上提供页眉或页脚

rotativa不在SSL上提供页眉或页脚
EN

Stack Overflow用户
提问于 2016-06-14 18:29:32
回答 2查看 1.2K关注 0票数 1

我正在使用

        string customSwitches = string.Format("--header-html  \"{0}\" " +
                      "--header-spacing \"0\" " +
                      "--footer-html \"{1}\" " +
                      "--footer-spacing \"10\" " +
                      "--footer-font-size \"10\" " +
                      "--header-font-size \"10\" , Url.Action("xxx", "xxxx", new { hid = xxxx.ID }, httType), Url.Action("Footer", "xxxxx", new { hid = xxxxx.ID }, httType ));

    var actionResult = new Rotativa.ViewAsPdf("Letter")
        {
            FileName = gid.ToString(),
            CustomSwitches = customSwitches
        };

这在本地和测试上都很好用,但当我把它放到live (使用SSL)时,它就会出现以下错误:-

System.Exception: 
Error: Failed loading page https://xxxxxxxxx/xxxxxxxx/header?hid=0 (sometimes it will work just to ignore this error with --load-error-handling ignore) Error: Failed loading page https://134.213.201.226/Discharge/Footer?hid=0 (sometimes it will work just to ignore this error with --load-error-handling ignore) Exit with code 1 due to network error: UnknownNetworkError 

System.Exception: Error: Failed loading page https://xxxxxxx/xxxxxxxx/header?hid=0 (sometimes it will work just to ignore this error with --load-error-handling ignore)
Error: Failed loading page https://xxxxxxxxxx/xxxxxxxxx/Footer?hid=0 (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.ConvertHtml(String wkhtmltopdfPath, String switches, String html)
   at Rotativa.ViewAsPdf.CallTheDriver(ControllerContext context)
   at Rotativa.AsPdfResultBase.BuildPdf(ControllerContext context)

你知道为什么页眉和页脚不能实时渲染吗?当我这样做时,通过浏览器导航到页眉和页脚,它们呈现在页面上。

EN

回答 2

Stack Overflow用户

发布于 2017-04-05 19:10:31

我认为这是Rotativa的内部问题。然而,这是我的同事想出的一种变通办法。

在服务器上,转到C:\Windows\System32\drivers\etc

打开文件'hosts‘

添加服务器IP,后跟主机名。例如: 127.0.0.1 www.stackoverflow.com

票数 1
EN

Stack Overflow用户

发布于 2017-03-16 22:53:59

你必须在你的web应用程序中添加以下动态链接库到"Rotativa“文件夹:(我想,你已经有了"wkhtmltopdf.exe”文件)

msvcp120.dll,msvcr120.dll,vccorlib120.dll。

这些文件位于"C:\Windows\SysWOW64“。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37809453

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档