private static void UseExplicitHosting() { // 1. Create the owin host var owinHost = new OwinHost(); // 2. Add deployment specific functionality owinHost.AddHostService(new ConsoleOutput()); // 3. Set the server to use owinHost.SetServer(new TcpServer(port: 1337)); // 4. Pass Pipeline or AppFunc to host. // Host will call back into Pipeline to execute setup owinHost.SetApp(BuildPipeline()); // 5. Run the host, consume yourself using (owinHost.Run()) { Console.WriteLine("Listening on port 1337. Enter to exit."); Console.ReadLine(); } }
public TestHostAndServer(MiddlewareFunc middleware, AppFunc next = null, IEnumerable<IOwinHostService> hostServices = null) { _host = BuildHost(hostServices); _host.SetApp(environment => middleware(environment, next ?? Pipeline.ReturnDone)); }
public TestHostAndServer(Pipeline pipeline, IEnumerable<IOwinHostService> hostServices = null) { _host = BuildHost(hostServices); _host.SetApp(pipeline); }
public TestHostAndServer(AppFunc app, IEnumerable<IOwinHostService> hostServices = null) { _host = BuildHost(hostServices); _host.SetApp(app); }