The first thing you should do is attach a debugger to your service and see what exception is thrown. You can do this by adding this function in your service:
/// <summary>/// Helper function to attach a debugger to the running service./// </summary>[Conditional("DEBUG")]static void DebugMode(){ if (!Debugger.IsAttached) Debugger.Launch();
Debugger.Break();}
Then, at the beginning of your OnStart() method, add a call to DebugMode().
Looking at your code, everything looks good except this line:
GUID = Assembly.GetExecutingAssembly().GetType().GUID.ToString()
You're getting a GUID of the Assembly object type? Huh? I don't know if this is causing your crash, but it certainly looks wrong. I'm fairly certain this "Type.GUID" property will change from execution to execution (which is not what you want). Change this to:
GUID = "companyname-appname"
Or you can generate a GUID in Visual Studio by clicking the "Tools" menu and clicking "Create GUID".
Tell me what exceptions you get after attaching the debugger and running your service again.