gpt4 book ai didi

html - rotativa 不在 SSL 上提供页眉或页脚

转载 作者:太空宇宙 更新时间:2023-11-03 13:24:23 27 4
gpt4 key购买 nike

我正在使用

        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
};

它在本地和测试中运行良好,但一旦我将它放在现场(使用 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)

知道为什么页眉和页脚无法实时呈现吗?当我通过浏览器导航到页眉和页脚时,它们会呈现在页面上。

最佳答案

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

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

打开文件'hosts'

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

关于html - rotativa 不在 SSL 上提供页眉或页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37809453/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com