Question

I have a custom windows service written in c# that I need to install and debug. When I use

installutil "[path].exe"

from the command line and then try and search for the service, it doesn't appear in the list of installed services anywhere. Looking at the install log file, i see this:

Installing assembly 'myservice'.   
Affected parameters are:  
   logtoconsole =    
   assemblypath = mypath  
   logfile = mylogfile  
Installing service MyService  
Service MyService has been successfully installed.  
Creating EventLog source MyService in log Application...  
Committing assembly 'myservice'.  
Affected parameters are:  
   logtoconsole =   
   assemblypath = myservice  
   logfile = pathtoinstalllog  
Uninstalling assembly myservice  
Affected parameters are:  
   logtoconsole =   
   assemblypath = myservice   
   logfile = pathtoinstalllog  
Removing EventLog source myservice.  
Service myservice is being removed from the system...  
Service myservice was successfully removed from the system.  
Uninstalling assembly myservice'.  
Affected parameters are:    
   logtoconsole =   
   assemblypath = myservice  
   logfile = pathtoinstalllog  
Removing EventLog source myservice.  
Service myservice is being removed from the system...  
Service myservice was successfully removed from the system.

(The names path, myservice, pathtoinstalllog, etc are in place of company specifics)

Anyway, from the log file it looks as if the service is being installed and then immediately uninstalled...

If any more code or info is needed, let me know, and thanks in advance.

Was it helpful?

Solution

to sum it up per our discussion...

  • use 'InstallUtil full-path' to your service main output (bin/debug/assembly.exe). Usually if there's an error InstallUtil 'performs rollback' (so watch for errors) - it looks like it's doing so but your log doesn't say - so I'm guessing your 'myservice' is of wrong path (also pick the right InstallUtil version, .NET framework and 32/64)...

  • for security/account issues - run InstallUtil elevated ('run as admin', the command prompt etc.) - (and for additional debugging if needed, try specifying different user/type for your service account, check your installer class details, RunInstaller attribute etc.).

hope this helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top