Convert console application to windows service
c#, service, signalr
Solution
How are you running the installation? I'd wager a guess that you're registering a 32-bit compiled application with the 64 bit installer or vice versa
In other words, running:
%windir%\Microsoft.NET\Framework\v4.0.30319\installutil.exe <My x64 DLL/EXE>
or:
%windir%\Microsoft.NET\Framework64\v4.0.30319\installutil.exe <My x86 DLL/EXE>
Problem
I have a console application which I am running SignalR with. I am attempting to convert it into a windows service application. I simply swapped out the `Main` method with ``` static void Main() { var servicesToRun = new ServiceBase[] { new MyService() }; ServiceBase.Run(servicesToRun); } ``` and added a service class which is simply: ``` namespace Services { partial class MyService : ServiceBase { IDisposable SignalR { get; set; } public MyService() { InitializeComponent(); } protected override void OnStart(string[] args) { const string url = "https://localhost:8080"; using (SignalR = WebApp.Start<Startup>(url)) { //TODO: Add Logging } } protected override void OnStop() { SignalR.Dispose(); } } } ``` But now when I try to run the installer I get the error: Exception occurred while initializing the installation: System.BadImageFormatException: Could not load file or assembly 'file:///C:\Code \MyCode\Services\bin\Debug\MyService.exe' or one of its dependencies. A n attempt was made to load a program with an incorrect format.. Is there any easy way to debug this message? Or does anyone have any idea of what I may have missed?