alejoup
1/24/2020 - 9:18 PM

Windows Services C# Debug without Installins Services

On the service class (DERIVED CLASS FROM ServiceBase you should to add:

#if DEBUG
        public void onDebug()
        {
            OnStart(null);
        }
#endif

OnStart is a protected method then it could be called by implement a public method

And within the static void Main() you should add:

static void Main()

{

#if DEBUG

MediationService myService = new MediationService();

myService.OnStart();

System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);

#endif

}