Run .net core 3.1 window service as Administrator need to start winform application

  .net, .net-core, c++, service, windows

I have developed a .net core 3.1 windows service (starttesterservice) that listens for request messages to start a winform tester applcation. The starttesterservice is run with elevated permissions via the app.mainfest:

<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
  <assemblyIdentity version="" name="" />
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">   
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
        <PermissionSet Unrestricted="true" ID="Custom" SameSite="site" />
        <defaultAssemblyRequest permissionSetReference="Custom" />
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">

When the starttesterservice receives a test request message, it starts the winform tester.exe application.

 ProcessStartInfo startInfo = new ProcessStartInfo();
 startInfo.UseShellExecute = true;
 startInfo.WorkingDirectory = exePath;
 startInfo.FileName = Path.Combine("c:tester", "tester.exe");
 startInfo.Verb = "runas";
 startInfo.Arguments = parameters;
 startInfo.ErrorDialog = true;

 Process process = Process.Start(startInfo);

The tester application has a app.manifest to elevate it to admin permission as well. Same app.manifest shown above.

When I run the starttesterservice in VS 2019, the windform tester UI gets launched without issue and the test can be completed. However, when I run the starttesterservice as a windows 10 service the Tester UI is not displayed. I’m using my domain user account as the service login account. I have admin privilege’s to the local machine. The admin group has been added to the local security policy. When I send the test request message to the starttesterservice the application is started without the UI being visible. In the task manager I see the tester.exe process is running. I could use some advise on how to get the UI to be displayed so that the user can complete the test.

Source: Windows Questions