I followed the steps here to make my existing WCF service (already working fine as console application) be Windows Service as well, on my Windows 7 machine which is also my development machine.
No matter what I tried, when doing the last step of using installutil, I'm getting the following message in the command line:
Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'file:///[path here]' or one of its dependencies.
An attempt was made to load a program with an incorrect format..
I have my console application main class inherit from ServiceBase
and implement OnStart
and OnEnd
methods.
I have added ProjectInstaller
class inheriting from System.Configuration.Install.Installer
marked with [RunInstaller(true)]
attribute and with the code they supplied in the constructor.
What I already tried that is not mentioned in the above article?
- Running the command line as administrator
- Navigating to the directory where the EXE file is located and running installutil from there
- Giving strong key to the EXE file and all DLL's it's using
Also, I don't get any log file even when specifying it with /LogFile=myLog.txt
.
Any ideas are welcome, thanks.