Windows Service and SystemFileWatcher
-
Hi, Can a windows service run a console application? Basically my goal is to have a windows service with a FileSystemWatcher monitor a directory. If that directory has any MS Word documents in it, convert them to pdf and then move them to their final resting place. I've created the windows service, it finds the files and starts a MS Word in the background. But on the line that opens a document, it fails. I presume because its running from a windows service and MS Word is probably trying to display some dialog. So my thinking is that if I move the conversion functionality to a console app and just let the windows service do the monitoring it will work. Thanks for the feedback!
Just because we can; does not mean we should.
-
Hi, Can a windows service run a console application? Basically my goal is to have a windows service with a FileSystemWatcher monitor a directory. If that directory has any MS Word documents in it, convert them to pdf and then move them to their final resting place. I've created the windows service, it finds the files and starts a MS Word in the background. But on the line that opens a document, it fails. I presume because its running from a windows service and MS Word is probably trying to display some dialog. So my thinking is that if I move the conversion functionality to a console app and just let the windows service do the monitoring it will work. Thanks for the feedback!
Just because we can; does not mean we should.
-
Your service can launch a console app (invisible if necessary) and pass arguments to it etc... so pass the filename to be opened to the console app and let that handle the word/pdf stuff.
Dave
Thank you
Just because we can; does not mean we should.