示例#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;
 }
示例#2
0
 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;
 }
示例#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();
            }
        }