Repro:
Adding TopShelf.Owin to a Console application targeting .NET 4.5, setting up HostFactory per ReadMe.md example (adding an explicit .CreateUsing(() => new YourService())) yields the following exception:
Configuration Result:
[Success] Name YourService
[Success] ServiceName YourService
Topshelf v3.1.135.0, .NET Framework v4.0.30319.42000
[Topshelf.Owin] Starting OWIN self-host, listening on: http://localhost:8080/
Topshelf.Hosts.ConsoleRunHost Error: 0 : An exception occurred, System.MissingMe
mberException: The server factory could not be located for the given input: Micr
osoft.Owin.Host.HttpListener
at Microsoft.Owin.Hosting.Engine.HostingEngine.ResolveServerFactory(StartCont
ext context)
at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
at Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider service
s, StartOptions options, Action1 startup) at TopShelf.Owin.WebAppConfigurator.Start() at TopShelf.Owin.OwinServiceConfiguratorExtensions.<>c__DisplayClass0_01.<Ow
inEndpoint>b__0(HostStartContext t)
at Topshelf.Runtime.EventCallbackList1.Notify(T data) at Topshelf.Runtime.ServiceEventsImpl.BeforeStart(HostControl hostControl) at Topshelf.Builders.DelegateServiceBuilder1.DelegateServiceHandle.Start(Hos
tControl hostControl)
at Topshelf.Hosts.ConsoleRunHost.Run()
Exiting with code 1.
Press ENTER to exit...
I suggest adding Microsoft.Owin.Host.HttpListener to package.config
Repro: Adding TopShelf.Owin to a Console application targeting .NET 4.5, setting up HostFactory per ReadMe.md example (adding an explicit
.CreateUsing(() => new YourService())
) yields the following exception:After manually adding Microsoft.Owin.Host.HttpListener to the console application, it ran fine.