Example #1
0
 private static OwinHost BuildHost(IPAddress address, int? port, IEnumerable<IOwinHostService> hostServices) {
     var host = new OwinHost();
     if (hostServices != null) {
         foreach (var hostService in hostServices) {
             host.AddHostService(hostService);
         }
     }
     host.SetServer(new TcpServer(address, port));
     return host;
 }
 private IOwinHost BuildHost(IEnumerable<IOwinHostService> hostServices = null) {
     IOwinHost host = new OwinHost();
     host.AddHostService(_traceOutput);
     if (hostServices != null) {
         foreach (var hostService in hostServices) {
             host.AddHostService(hostService);
         }
     }
     host.SetServer(this);
     return host;
 }
Example #3
0
        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(Pipeline pipeline, IEnumerable<IOwinHostService> hostServices = null) {
     _host = BuildHost(hostServices);
     _host.SetApp(pipeline);
 }
 public TestHostAndServer(MiddlewareFunc middleware, AppFunc next = null, IEnumerable<IOwinHostService> hostServices = null) {
     _host = BuildHost(hostServices);
     _host.SetApp(environment => middleware(environment, next ?? Pipeline.ReturnDone));
 }
 public TestHostAndServer(AppFunc app, IEnumerable<IOwinHostService> hostServices = null) {
     _host = BuildHost(hostServices);
     _host.SetApp(app);
 }