I found once how to do this and it was a lifesaver. Now I can't remember which program has the code and I can no longer find on the Internet what I am looking for and have it work.
I thought it was this:
But I don't know what to change the bold-face line to.Code:// The main entry point for the process static void Main() { #if (!DEBUG) System.ServiceProcess.ServiceBase[] ServicesToRun; ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service1() }; System.ServiceProcess.ServiceBase.Run(ServicesToRun); #else // Debug code: this allows the process to run as a non-service. // It will kick off the service start point, but never kill it. // Shut down the debugger to exit Service1 service = new Service1(); service.<Your Service's Primary Method Here>(); // Put a breakpoint on the following line to always catch // your service when it has finished its work System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite); #endif }
This is my code in the !debug path:
But when I try to put this in my debug path,Code:ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new ReceiveShippingFile() }; ServiceBase.Run(ServicesToRun);
I don't get any methods displayed by intellisense after I type myService-dot.Code:// Debug code: this allows the process to run as a non-service. // It will kick off the service start point, but never kill it. // Shut down the debugger to exit ReceiveShippingFile myService = new ReceiveShippingFile(); myService.


Reply With Quote