I have a console application with which I run SignalR. I am trying to convert it to a windows application.
I just changed the method Mainto
static void Main()
{
var servicesToRun = new ServiceBase[]
{
new MyService()
};
ServiceBase.Run(servicesToRun);
}
and added a class of service that is simple:
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))
{
}
}
protected override void OnStop()
{
SignalR.Dispose();
}
}
}
But now, when I try to run the installer, I get an error message:
An exception occurred during initialization of the installation: System.BadImageFormatException: Failed to load file or assembly 'file: /// C: \ Code \ MyCode \ Services \ bin \ Debug \ MyService.exe' or one of its dependencies. An attempt was made to download a program using the wrong format.
Is there an easy way to debug this post? Or does anyone have an idea of what I might have missed?