Register  |  Login

 Blog List
Minimize
 RSS
Minimize
You must be logged in and have permission to create or edit a blog.
 View Blog
Minimize
Oct 6

Written by: Usman Shabbir
10/6/2010 4:48 PM 

Step 1: Create a windows Service.
Setp 2: Open Program.cs
Step 3: Comment the main function
Step 4: Add the Following in ur main function

static void Main()
#if (!DEBUG) System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service1() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);

#else
// Name of ur Service
Service1 service = new Service1();
// The Function you want to call on start
service.XYZ(); System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
#endif
}




Happy Debugging...

Source: Check Full Code here

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel