0

I am running a console application with no UI and generate thumbmail images from pdf files. The compile file for this application works fine. However I have to call this compile file from windows service application that implement the the FileSystemWatcher class to detect when new pdf files are uploaded into the directory.

and I am using the suggestion from this link How to run console application from Windows Service?

ProcessStartInfo info = new ProcessStartInfo(appName);
info.UseShellExecute = false;
info.RedirectStandardError = true;
info.RedirectStandardInput = true;
info.RedirectStandardOutput = true;
info.CreateNoWindow = true;
info.ErrorDialog = false;
info.WindowStyle = ProcessWindowStyle.Hidden;

Process process = Process.Start(info);

if (!process.HasExited)
{
   LogEvent(process.ProcessName + "has started and called Thumbnail application");
}
 else
{ LogEvent(process.ProcessName + "has been terminated"); }

I can see the process involking the "pdfThumbnail.exe" but I am getting this error when the application try to execute.

"System.Exception: Cannot create ActiveX component. at Microsoft.VisualBasic.Interaction.CreateObject(String ProgId, String ServerName) at PDFThumbnailCsharp.Main(String[] args) "

As I have said above the pdfThumbnail.exe execute fine when i run the exe file.

Updates

This is the error from the SysInternals' Process Monitor

The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID {FF76CB60-2E68-101B-B02E-04021C009402} and APPID Unavailable to the user NT AUTHORITY\LOCAL SERVICE SID (S-1-5-19) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.

I have changed the ownership of this CLSID to Administrator with Full control as described on this link http://social.technet.microsoft.com/Forums/en-US/windowsserver2008r2general/thread/e303c7e1-16de-42fd-a1a4-7512c1261957

However I am still getting the same error.

Any help will be appreciated.

Thanks

Community
  • 1
  • 1
  • Session 0, the home for services, is quite an inhospitable home for ActiveX controls. There are many possibilities, you need to improve your question by researching the problem better. Good place to start is from the trace you get out of SysInternals' Process Monitor. Compare a good one with a bad one, focus on it looking at the CLSID registry key and it trying to locate the DLL. – Hans Passant May 06 '14 at 11:20

1 Answers1

0

This CLSID {FF76CB60-2E68-101B-B02E-04021C009402} is for Acrobat.Excha.PDDoc on my computer registry. Further investigation with Acrobat on this link https://forums.adobe.com/thread/1467460 revealed that Acrobat cannot be run from service.

What I have done for now until I have a better approach is to create a windows Task Scheduler that listen to an event raised by the windows service when new pdf are created and then trigger the console app that create the thumbnails.