This project has moved and is read-only. For the latest updates, please go here.

Selfhosting in windows service "MissingMemberException" with version 1.1

Jul 8, 2013 at 2:22 PM
Edited Jul 8, 2013 at 2:23 PM
I try to start selfhosting in windows service with this code :
var options = new Microsoft.Owin.Hosting.StartOptions();
options.Urls.Add("http://localhost:1234");
options.AppStartup = this.GetType().AssemblyQualifiedName;
var server = Microsoft.Owin.Hosting.WebApp.Start(options, BuildApp);
I have an exception :
System.MissingMemberException occurred
HResult=-2146233070
Message=The server factory could not be located for the given input:
Source=Microsoft.Owin.Hosting
StackTrace:
   à Microsoft.Owin.Hosting.Engine.HostingEngine.ResolveServerFactory(StartContext context)
   à Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
   à Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider services, StartOptions options, Action`1 startup)
   à Microsoft.Owin.Hosting.WebApp.Start(IServiceProvider services, StartOptions options, Action`1 startup)
   à Microsoft.Owin.Hosting.WebApp.Start(StartOptions options, Action`1 startup)
   à ERPStore.Host.Hoster.StartSelfHosting() 
My package list is :

<package id="Microsoft.AspNet.SignalR.Core" version="2.0.0-beta2" targetFramework="net45" />
<package id="Microsoft.AspNet.SignalR.SelfHost" version="2.0.0-beta2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.0.0-beta2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.0.0-beta2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.0.0-beta2" targetFramework="net45" />
<package id="Microsoft.Owin" version="1.1.0-beta2" targetFramework="net45" />
<package id="Microsoft.Owin.Host.HttpListener" version="1.1.0-beta2" targetFramework="net45" />
<package id="Microsoft.Owin.Hosting" version="1.1.0-beta2" targetFramework="net45" />
<package id="Microsoft.Owin.Security" version="1.1.0-beta2" targetFramework="net45" />
<package id="Newtonsoft.Json" version="5.0.6" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net40" />
<package id="Owin.Extensions" version="0.8.5" targetFramework="net40" />
<package id="Owin.Types" version="0.8.5" targetFramework="net40" />


What is a good pratice to start ?
Jul 8, 2013 at 4:29 PM
Make sure Microsoft.Owin.Host.HttpListener.dll is being deployed with your app.

As a fallback you can specify options.ServerFactory = "Microsoft.Owin.Host.HttpListener"

Jul 8, 2013 at 5:30 PM
yes that was the problem, it was missing this assembly
Thank you Tratcher