2016-06-14 25 views
1

不服務頁眉或頁腳我使用rotativa對SSL

 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) 

任何想法,爲什麼頁眉和頁腳不會現場呈現?當我通過他們在頁面上呈現的瀏覽器導航到頁眉和頁腳時。

+0

添加另一個扭曲,當在現場服務器上時,PDF也將呈現 – chris

回答

0

你必須添加下面的dll的網絡應用中,以「Rotativa」文件夾: (我猜,你已經用「wkhtmltopdf.exe」文件的話)

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

這些文件位於「C:\ Windows \ SysWOW64」中。

1

我認爲這是Rotativa的內部問題。不過,這是我的同事作爲解決方法提出的一種方式。

在您的服務器,進入C:\ WINDOWS \ SYSTEM32 \ drivers \ etc下

打開文件 '主機'

添加您的服務器的IP,然後你的主機名。例如:127.0.0.1 www.stackoverflow.com