1

I have a c# Windows Service that is required to call an exe periodically. That exe need to interact with desktop. When I installed the service, I clicked "Allow service to interact with desktop" option.

enter image description here

Service Starts fine but it is not running the exe as expected.

        var myProcess = new Process
        {
            StartInfo = new ProcessStartInfo(@"C:\windows\TestApplication\TestApplication.exe"),
            //StartInfo = new ProcessStartInfo(@"C:\temp\Projects\TestConsoleApp\TestConsoleApp\bin\Debug\TestConsoleApp.exe"),
        };
        myProcess.StartInfo.Domain = "MyDomain";
        myProcess.StartInfo.UserName = "Testuser";
        myProcess.StartInfo.Password = pwd;
        myProcess.StartInfo.CreateNoWindow = true;
        myProcess.StartInfo.UseShellExecute = false;
        myProcess.StartInfo.CreateNoWindow = true;
        myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        myProcess.Start();
        myProcess.WaitForExit();

Any ideas as to what could be the issue? Is Local System Account does not have access to the System ? How do I find the Local System Account?

Any pointers?

Alex K.
  • 171,639
  • 30
  • 264
  • 288
ProgSky
  • 2,530
  • 8
  • 39
  • 65
  • 2
    That option was depreciated in Vista, you should be using the design where your service communicates with an application thats run when a user logs on. Consider the situation where there are 2 interactive users, given your current design what session/desktop would the application run in? – Alex K. Sep 22 '17 at 17:15
  • Thanks Alex. I will have to rethink the design then. My Application (Windows Service) scans a table in database, gets all document and user webBrowser.Print() to print to PDF. webBrowser.Print() was the part that was failing when I had service in release mode . (https://social.msdn.microsoft.com/Forums/Windowsapps/en-US/bbff0a59-b05d-4fe4-81b2-a05c78305345/mshtml-failing-to-work-in-release-mode?forum=ieextensiondevelopment) . Then Chose to convert the webBrowser.Print() to a console app and tried to fire it with my service. – ProgSky Sep 22 '17 at 17:56

0 Answers0