In my case, the windows service was working fine on Local, but while deploying on another machine. I created the service using SC commands which was done successfully, but on starting the service, I got this error.
Solution that worked for me:
1) On my local computer, cleared the data of Debug and Release folders in both bin and obj directories.
2) Then deployed, created and started the service successfully.
Solution that worked for me:
1) On my local computer, cleared the data of Debug and Release folders in both bin and obj directories.
2) Then deployed, created and started the service successfully.