Starting a GUI Application in Windows Service Mode

I am writing a server running as a Windows service that, on request, calls Firefox to create a pdf snapshot of a web page.

I know that it is a bad idea to run a GUI program in service mode, but the nature of my program limits its launch in user mode. Starting a proxy at the user level is also not an option, since an interactive user cannot be on a computer with a running server.

In my experiments, Firefox successfully released pdf when the service started under a user account that was already registered. Obviously, this did not work in other cases: for local systems and user accounts that were not logged in. In LocalSystem with the option "Allow the service to interact with the desktop", I saw how Firefox began to report that it could not find the printer.

Since it would be impractical to require an open user session to start a pdf server, is there any workaround for this, except that it all comes from a virtual machine?

UPDATE: I realized that the problem was not with account permissions, but with the invisible modal dialog that FF expected while working in service mode.

- PDF , FF LocalSystem. FF , , , ?

+3
4

, , .NET PDF (PDFsharp - , , ) , WebBrowser, PDF.

STAThread, .

+7

, MS Word . , Firefox, .

, , - .

, - , , ,

0

: -, Ghostscript PS- > PCL . - , - Ghostscript . , HKCU-hive HKLM.

0
source

Can I run the program as a scheduled task? A task can be assigned to a given user account, which should work with service restrictions.

0
source

Source: https://habr.com/ru/post/1739915/


All Articles