I'm running Win8.1 and am building a .NET4.5 windows service in C#. When executing doc2pdf from the command line it all works fine. With for example this string:
"C:\Program Files (x86)\Pro v6.0\doc2pdf.exe" -i "C:\1Temp\635296083729535451.xml.html" -o "C:\1Temp\635296083729535451.xml_stylesheet.tif" -b 1 -c 4 -r 300
But when executing the same code from the windows service I see that the process is started in the TaskManager but it doesn't do anything. It keeps hanging there forever without doing anything at all for hours and hours :).
Would you have any idea what the problem could be? My code looks as follows:
Interaction.Shell(doc2PdfArguments, AppWinStyle.Hide, true, -1);
The variable doc2PdfArguments is the same string as entered before.
Any help is truly appreciated.
You can use VeryPDFComRunCmd COM to call doc2pdf.exe from a Windows Service,
VeryPDFComRunCmd is an EXE COM Component which can be used to launch any EXE or Office application from ASP, PHP, C#, .NET etc. program languages. VeryPDFComRunCmd COM is a freeware. (More Information)
VeryPDFComRunCmd.zip (825 KB).
You can use following ASP code to call any EXE or MS Office without any permission problem,
set VeryPDFCom = Server.CreateObject("VeryPDFCom.RunCmd")
dim nRetVal, bRet
bRet = VeryPDFCom.RunCmd("C:\windows\notepad.exe", 5, 0)
strRet = VeryPDFCom.RunCmd2("cmd /c dir C:\", 5)
Response.Write strRet & vbCrlf
VeryPDFComRunCmd COM is a Windows COM Component, it can be used to call any EXE application from Windows Service, ASP Code, Local System user account etc.
The second solution is Run conversion via "_Service.exe" application, please look at following web page for more information,