0

We have a legacy windows service that I am installing on a new computer. I have the installer and when I run it or alternatively use installutil from the command prompt, I get the following:

An exception occurred during the Install phase. System.InvalidOperationException: An exception occurred in the OnAfterInstall ev ent handler of System.ServiceProcess.ServiceInstaller. The inner exception System.InvalidOperationException was thrown with the followi ng error message: Cannot start service W2MonitorsFileWatcher on computer '.'.. The inner exception System.ComponentModel.Win32Exception was thrown with the fol lowing error message: The service did not start due to a logon failure.

I'm running it from a command prompt as Administrator. So I don't know what is causing this.

Any ideas? I have the original source but it's years old and in an old version of visual studio, so I am loathe to dig it up out of the repo and try to rebuild it if there's a simple solution. Any ideas welcome - I considered creating a dummy service and installing it and replacing the .exe with my legacy app, do you think that would work?

NibblyPig
  • 51,118
  • 72
  • 200
  • 356

1 Answers1

1

Is this a .NET application? If yes, you can use .DotPeek to open the assembly and just have a peek at OnAfterInstall. Mostly the service is trying to modify something or start something with some hardcoded credentials and is failing.

You can just use SC Create to create the service and see if that suffices. SC create will not run the OnAfterInstall I think so you should not face any errors but what it does in OnAfterInstall may be needed for proper working on the service

Ganesh R.
  • 4,337
  • 3
  • 30
  • 46