Thursday, February 26, 2015

debugging a windows service

follow this pattern in program file

#if DEBUG
            MethodInfo mi = qCenterService.GetType().GetMethod("OnStart", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.NonPublic);
            mi.Invoke(BlahService, new object[] { new string[0] });
            Console.ReadLine();
#else
                     ServiceBase.Run(new ServiceBase[] { BlahService });

#endif

No comments:

Post a Comment