0

Several years ago I developed a windows service. The current version uses VS2010, and the project has a service installer attached. All has been working, and the last publish I performed was at the beginning of 2013 (around a year ago).

I have made significant changes to the project and attempted a publish, however the resulting 'setup.exe' file seems to not be a service installer, as when run it does not register the service and errors with the following message:

'Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutl.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command.'

Now, before you go here's a nice easy question (well I hope it is something silly), I have followed the below links to the 'T', the installer is setup as a service, and the ServiceName matches between the program class and the installer.

http://msdn.microsoft.com/en-us/library/ddhy0byf(v=vs.110).aspx

http://msdn.microsoft.com/en-us/library/zt39148a%28v=vs.100%29.aspx

Additionally I have tried the following:

  • Loaded the project in VS2012 - Still the same error
  • Created a new blank service following the above steps to add the installer. Again this has caused the same error, so the project can't be at faught.

Has anyone ideas what the problem could be, or properties/settings to check? I remember when I used VS2008, the installer was setup as a separate project. I could go down that route, but would really like to find out what is going wrong using this method.

Radderz
  • 2,770
  • 4
  • 28
  • 40
  • Microsoft has deprecated the Windows Installer project type in Visual Studio 2012. They provide Install Shield LE as a sort of replacement, but it doesn't work the same way and in many cases does not perform the same tasks. – Erik Funkenbusch Feb 03 '14 at 02:50
  • Oh no, that's my backup solution gone :| – Radderz Feb 03 '14 at 10:48
  • Could you clarify your scenario slightly - you mention the setup exe, but the error message implies you are running in the IDE? To my knowledge (far from exhaustible) you can't debug the service as such. When I was writing a service last, I added another project for start-up to allow for runtime debugging, in conjunction with copious logging to the event log when testing the fully installed service. – Paul Eden Feb 05 '14 at 16:13
  • This turned out to be an installer problem. As @ErikTheViking said, the inbuilt installer was deprecated, and while I still had it within my project it had stopped working correctly for installing services. I managed to get around this by using a 3rd party installer toolset by WiX http://wix.codeplex.com/ – Radderz Feb 17 '14 at 11:21
  • @PaulEden You can [debug services](https://stackoverflow.com/questions/4678819/how-to-debug-windows-services-in-visual-studio#22706012). – doug65536 Aug 13 '17 at 03:32

1 Answers1

0

This turned out to be an installer problem. As @ErikTheViking said, the inbuilt installer was deprecated, and while I still had it within my project it had stopped working correctly for installing services.

I managed to get around this by using a 3rd party installer toolset by a WiX.

Radderz
  • 2,770
  • 4
  • 28
  • 40