So I am working on writing a Windows Service in VB.NET
don’t want to tell the whole story now, but its used to deploy applications to servers. It can run as both a console application and Windows Service. On of the problems with Windows Services in Visual Studio is the lack of an easy way to debug/test the service. The way I worked it, was by checking the parent process of my self, and if that process is “services” I then know I need to start ServiceBase
Anyway, while testing it, one machine just refused to start the service. The was no errors in the event log, so I was 99% sure the services wasn’t even being started. Weird, I spent a lot of time troubleshooting that. I have all my code wrapped in Try Catch statements and I log accordingly so this was driving me crazy. Being desperate I finally added a log entry for every single line of code in the 2 main classes to see what the hell was going on. turns out my code for finding parent process was “stalling”.
I used the common WMI approach for finding my parent process, turns out my service “stalled” at this point, I’m guessing since a service needed wasn’t started yet, and my service timed out.
Sure, that works but .. running as a service I'm guessing some other service need to be started in order for WMI to work. I don’t know, I don’t care I never liked WMI anyway so back to Google and look for an alternative. and this is what I ended up with