pruiz / WkHtmlToXSharp

C# wrapper wrapper (using P/Invoke) for the excelent Html to PDF conversion library wkhtmltopdf library.
239 stars 84 forks source link

Access violation on IIS 7.5 windows 2008 R2 #30

Closed manugatlin closed 8 years ago

manugatlin commented 9 years ago

Hi,

We encounter an issue sometimes on our website with wkhtml when we restart Server Application or deploy news files. To resolve this problem, we need to recycle pool after each deployment.

Thanks,

Log:

Message: Une exception a été levée par la cible d'un appel.

Exception type: System.Reflection.TargetInvocationException Stack Trace: at Sanford.Threading.DelegateQueue.EndInvoke(IAsyncResult result) at Sanford.Threading.DelegateQueue.Invoke(Delegate method, Object[] args) at WkHtmlToXSharp.MultiplexingConverter.Convert(String inputHtml) at PrevifranceFront.Previfrance.Services.getFile.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Message: Tentative de lecture ou d'écriture de mémoire protégée. Cela indique souvent qu'une autre mémoire est endommagée.

Exception type: System.AccessViolationException Stack Trace: at WkHtmlToXSharp.NativeCalls.wkhtmltopdf_convert(IntPtr converter) at WkHtmlToXSharp.WkHtmlToPdfConverter._Convert(String inputHtml) at WkHtmlToXSharp.WkHtmlToPdfConverter.Convert(String inputHtml) at WkHtmlToXSharp.MultiplexingConverter.b__9(String x)

pruiz commented 8 years ago

Running this library under ASP.NET (or more specifically IIS) is not supported. This has to do with the way IIS manages underlaying threads, and application pools.

What most people do (myself included) is to create a daemon or windows service which handles requests from the ASP.NET/MVC/etc. process via any form of RPC or queuing.

Regards