What could cause EvoPDF “unable to render html” exception when deployed to Azure Website

删除回忆录丶 提交于 2019-12-30 11:56:25

问题


Using EvoPDF for a .Net web application works locally, however once deployed to a Microsoft Azure website it throws a generic exception: "unable to render html".

Stack trace:

[Exception: Could not render the HTML string.]
   EvoPdf.HtmlToImageConverter.ᜀ(String A_0, String A_1, String A_2, ᜴& A_3, Hashtable& A_4) +2129
   EvoPdf.HtmlToPdfConverter.ᜀ(String A_0, String A_1, String A_2, String A_3, Boolean A_4) +8369
   EvoPdf.HtmlToPdfConverter.ᜀ(Stream A_0, String A_1, String A_2, String A_3, String A_4, Boolean A_5) +58
   EvoPdf.HtmlToPdfConverter.ᜁ(String A_0, String A_1, String A_2, String A_3, Boolean A_4) +126
   EvoPdf.HtmlToPdfConverter.ConvertHtml(String htmlString, String baseUrl, String internalLinksBaseUrl) +33
   EvoPdf.HtmlToPdfConverter.ConvertHtml(String htmlString, String baseUrl) +12
   td.Printing.Labels.Print.WithEvoPdf(HttpContext httpContext, Action`1 htmlPageRenderer, String outputFileName, Label labelFormat) in C:\...\Evo PDF Print Labels.vb:54
   td.OL3016WR.Render(HtmlTextWriter writer) in C:\...\OL3016WR.aspx.vb:166
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8921

回答1:


You've hit an Azure App Service sandbox runtime exectution limitation.

From https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#unsupported-frameworks:

Unsupported frameworks

Here is a list of frameworks and scenarios that have been found to be not be usable due to one or more of the restrictions above. It's conceivable that some will be supported in the future as the sandbox evolves.

PDF generators failing due to restriction mentioned above:

EVOPDF
Rotativa
wkhtmltopdf
Syncfusion
Siberix
NReco (uses wkhtmltopdf)
Spire.PDF

Other scenarios:
PhantomJS/Selenium: tries to connect to local address, and also uses GDI+.

As you already mentioned this works fine in a Web/Worker Role (Cloud Services). Service Fabric or IaaS VM are other options.




回答2:


EvoPdf has a solution for Azure Websites. Check the http://www.evopdf.com/azure-html-to-pdf-converter.aspx page for more details.




回答3:


Found the general cause. Something about EvoPDF is not compatible with Azure websites. In a cloud services web role it works OK.



来源:https://stackoverflow.com/questions/38558044/what-could-cause-evopdf-unable-to-render-html-exception-when-deployed-to-azure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!