I had created a Lib Project with a class inherits ServiceBase but when I run the solution i’m not getting the EXE file?
public class Scheduler : ServiceBase
{
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[] {new Scheduler()};
Run(ServicesToRun);
}
}
First, make sure that your project type is
Windows Application, which is recommended for windows services.What you did is not enough in order to install and start your service. You cannot yet install your service. You have to provide an installer class which can then be used by
InstallUtilto register your service.You can see an example of this in the
ServiceProcessInstallerclass documentation.After that, build your service again and install it by running in a command window the following:
You will then be able to see your service in the services snap-in.