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!
If your connection string to the database is using windows security, it is possible that your debug user is able to access the database. But the windows service runs under another user.
So just to discard this option I would recommend the following:
Then restart the windows service and debug it.
Regards,