Application does not work

I am creating a service that runs a .exe file on Windows 7. It must run as a service due to complex requirements, so a console application is not possible.

I wrote the following code that works great in a console application, but when placed in a service, the executable never runs.

    ProcessStartInfo startInfo = new ProcessStartInfo();

    try
    {
        startInfo.WorkingDirectory = "C:\\Folder";
        startInfo.FileName = "MyApp.exe";
        Process myProcess = Process.Start(startInfo);             
    }
    catch (Exception ex)
    {
        using (StreamWriter writer = File.AppendText(path))
        {
            writer.WriteLine(ex.Message);
        }
    }
}

No errors occur, but the application simply does not start.

I read that services cannot run the executable in a simple way, and have modified the above code based on the suggestions, however it does not work.

EDIT: I configured the service manually as follows:

enter image description here

+1
source share
1 answer

, , , . , , , . , - "" Windows, , , Vista Windows 7 UAC. , UAC.

- , , UI ( ), 0, , ( ).

, . , ( ).

, , , .

0

All Articles