I'm having trouble running.exe from ASP.NET C# code on a Windows Server 2008 R2. I have tried everything I could find, but still have no luck.
The exit code of the process is -1073741502, and each attempt run generates an event log entry with this message:
Application popup: .exe - Application Error : The application was unable to start correctly (0xc0000142). Click OK to close the application.
These are all the things I've tried, with no luck:
- ran the command manually from an administrator elevated command prompt (works)
- ran the command manually from a normal command prompt (works after the above is run first)
- registered the htmlshell.dll manually both using the 32bit and 64bit regsvr32
- copied the two dlls mentioned in install.bat in both system32 and syswow64 folders
- tried with the latest htmltools.zip downloaded from from verypdf.com (which even though I supply it with a valid license key it still says it's a trial)
- added write privileges to all folders of the web application and the htmltools folder for the IIS application pool
- tried setting the Domain, Username and Password fields of the ProcessStartInfo object to my own Domain Admin credentials, and added full write privileges to my own user to all folders involved
- tried using both a 32bit and a 64bit IIS application pool
At this point, I have nothing else left to try. As far as I can see, the application fails to start because it's DLLs are not being loaded properly. (the 0xc0000142 error is STATUS_DLL_INIT_FAILED)
Is there something else I can try? Does the application work at all when launched from .NET under IIS 7.5?
Thanks for your message, you can use "VeryPDFComRunCmd COM Component" to call htmltools.exe from your ASP.NET C# code to convert HTML file to PDF file, "VeryPDFComRunCmd COM Component" can be downloaded from following web page,
You can set "VeryPDFCom.RunCmd" COM run inside administrator user account, then you can use following code to convert HTML file to PDF file from administrator user account,
set VeryPDFCom = CreateObject("VeryPDFCom.RunCmd")
dim nRetVal, bRet
strRet = VeryPDFCom.RunCmd2("D:\\verypdf\\htmltools.exe D:\\test.html D:\\out.pdf", 5)
strRet = VeryPDFCom.RunCmd2("D:\\verypdf\\htmltools.exe -webkit D:\\test.html D:\\out.pdf", 5)