I run a website with IIS 7.5 in classic ASP with an isolated Application Pool (ApplicationPoolIdentity). Inside this website I also run unmanaged code (wkhtmltopdf.exe) thru “WScript.Shell” object run method. After that I stream the result file as pdf
set wshell = CreateObject("WScript.Shell")
wshell.run wkhtmltopdf.exe http://www.mypagehanging.com c:\myfile.pdf", 0, TRUE
set wshell = nothing
Everything works fine but sometimes my Website Hang. It’s completely stuck. The wktmltopdf.exe running under the identity of the app pool (iis apppool\myapp) hangs.
This causes my all website to hang because i run the program with option bWaitOnReturn to true.
I cannot set this option to false because I must wait for the script to execute completely before streaming the pdf.
Couldn’t find any timeout option to give to wkhtmltopdf. Couldn’t understand why wkhtmltopdf was hanging. But it’s probably caused by the website I’m trying to render and not wkhtmltopdf.
Any suggestions ?
I’ve addressed this problem by killing the process if it takes an unusual amount of time to run.
here is my code should it be helpful to someone.
In the asp file
Code source for the KillProcess.exe