'Windows service popping calc in C# Error 216 0xd8

I coded this simple service -

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

namespace MySimpleService
{
    public partial class Service1 : ServiceBase
    {
        public Service1()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            Process p = new Process();
            ProcessStartInfo psi = new ProcessStartInfo();
            psi.FileName = "C:\\Windows\\System32\\calc.exe";
            psi.WindowStyle = ProcessWindowStyle.Normal;
            p.StartInfo = psi;
            p.Start();
        }

        protected override void OnStop()
        {
        }
    }
}

And when I installed it with sc.exe create test_service bitPath="<my_path>.exe", I got an error message Error 216 0xd8. I compiled the program on the same computer I ran the service on, any thoughts?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source