Am trying to develop a windows service which listens to a rabbitMQ listener and stores the messages it listens into database...the code is working perfectly in debug mode but is not working as a windows service....
Debug and service code:
if (!Environment.UserInteractive)
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new RabService()
};
ServiceBase.Run(ServicesToRun);
}
else
{
var service = new RabService();
service.OnStart(null);
Thread.Sleep(Timeout.Infinite);
}
Any inputs would be appreciated!