I followed the instructions given here to make my existing WCF service (already working perfectly as a console application) also a Windows service on my Windows 7 machine, which is also my development machine.
No matter what I tried, during the last step of using installutil, I get the following message at the command prompt:
An exception occurred while initializing the installation:
System.BadImageFormatException: Failed to load file or assembly 'file: /// [path here]' or one of its dependencies.
An attempt was made to download a program with the wrong format.
I have the main class of my console application that inherits from ServiceBase and implements the OnStart and OnEnd .
I added the ProjectInstaller class of the inheriting System.Configuration.Install.Installer tagged [RunInstaller(true)] attribute and with the code they are in the constructor.
What have I tried, what is not mentioned in the above article?
- Run command prompt as administrator
- Go to the directory where the EXE file is located and run installutil from there
- Providing a strong key to the EXE file and its entire DLL
In addition, I do not get any log file even when specifying it with /LogFile=myLog.txt .
Any ideas are welcome, thanks.
c # wcf windows-services installutil
Shadow wizard
source share