diff --git a/WebListener.sln b/WebListener.sln
index 1037bd9799..e8e84a23e0 100644
--- a/WebListener.sln
+++ b/WebListener.sln
@@ -29,6 +29,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Security.W
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Server.WebListener.FunctionalTests.net45", "test\Microsoft.AspNet.Server.WebListener.FunctionalTests\Microsoft.AspNet.Server.WebListener.FunctionalTests.net45.csproj", "{E7841BDA-EEE0-42D8-8E09-48F021B1934E}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SelfHostServer.k10", "samples\SelfHostServer\SelfHostServer.k10.csproj", "{990662B2-A857-4DD6-85F3-F8517ACAAB13}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -75,6 +77,10 @@ Global
{E7841BDA-EEE0-42D8-8E09-48F021B1934E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7841BDA-EEE0-42D8-8E09-48F021B1934E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7841BDA-EEE0-42D8-8E09-48F021B1934E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {990662B2-A857-4DD6-85F3-F8517ACAAB13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {990662B2-A857-4DD6-85F3-F8517ACAAB13}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {990662B2-A857-4DD6-85F3-F8517ACAAB13}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {990662B2-A857-4DD6-85F3-F8517ACAAB13}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -90,5 +96,6 @@ Global
{8B4EF749-251D-4222-AD18-DE5A1E7D321A} = {99D5E5F3-88F5-4CCF-8D8C-717C8925DF09}
{3EC418D5-C8FD-47AA-BFED-F524358EC3DD} = {E183C826-1360-4DFF-9994-F33CED5C8525}
{E7841BDA-EEE0-42D8-8E09-48F021B1934E} = {E183C826-1360-4DFF-9994-F33CED5C8525}
+ {990662B2-A857-4DD6-85F3-F8517ACAAB13} = {3A1E31E3-2794-4CA3-B8E2-253E96BDE514}
EndGlobalSection
EndGlobal
diff --git a/samples/SelfHostServer/Program.cs b/samples/SelfHostServer/Program.cs
deleted file mode 100644
index f01efdd682..0000000000
--- a/samples/SelfHostServer/Program.cs
+++ /dev/null
@@ -1,138 +0,0 @@
-// -----------------------------------------------------------------------
-//
-// Copyright (c) Microsoft Corporation. All rights reserved.
-//
-// -----------------------------------------------------------------------
-
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.Owin;
-using Microsoft.AspNet.Server.WebListener;
-using Microsoft.Owin.Hosting;
-using Owin;
-
-namespace SelfHostServer
-{
- // http://owin.org/extensions/owin-WebSocket-Extension-v0.4.0.htm
- using WebSocketAccept = Action, // options
- Func, Task>>; // callback
- using WebSocketCloseAsync =
- Func;
- using WebSocketReceiveAsync =
- Func /* data */,
- CancellationToken /* cancel */,
- Task>>;
- using WebSocketReceiveResult = Tuple; // count
- using WebSocketSendAsync =
- Func /* data */,
- int /* messageType */,
- bool /* endOfMessage */,
- CancellationToken /* cancel */,
- Task>;
-
- public class Program
- {
- private static byte[] Data = new byte[1024];
-
- public static void Main(string[] args)
- {
- using (WebApp.Start(new StartOptions(
- // "http://localhost:5000/"
- "https://localhost:9090/"
- )
- {
- ServerFactory = "Microsoft.AspNet.Server.WebListener"
- }))
- {
- Console.WriteLine("Running, press any key to exit");
- // System.Diagnostics.Process.Start("http://localhost:5000/");
- Console.ReadKey();
- }
- }
-
- public void Configuration(IAppBuilder app)
- {
- OwinWebListener listener = (OwinWebListener)app.Properties["Microsoft.AspNet.Server.WebListener.OwinWebListener"];
- listener.AuthenticationManager.AuthenticationTypes =
- AuthenticationType.Basic |
- AuthenticationType.Digest |
- AuthenticationType.Negotiate |
- AuthenticationType.Ntlm |
- AuthenticationType.Kerberos;
-
- app.Use((context, next) =>
- {
- Console.WriteLine("Request: " + context.Request.Uri);
- return next();
- });
- app.Use((context, next) =>
- {
- if (context.Request.User == null)
- {
- context.Response.StatusCode = 401;
- return Task.FromResult(0);
- }
- else
- {
- Console.WriteLine(context.Request.User.Identity.AuthenticationType);
- }
- return next();
- });
- app.UseWebSockets();
- app.Use(UpgradeToWebSockets);
- app.Run(Invoke);
- }
-
- public Task Invoke(IOwinContext context)
- {
- context.Response.ContentLength = Data.Length;
- return context.Response.WriteAsync(Data);
- }
-
- // Run once per request
- private Task UpgradeToWebSockets(IOwinContext context, Func next)
- {
- WebSocketAccept accept = context.Get("websocket.Accept");
- if (accept == null)
- {
- // Not a websocket request
- return next();
- }
-
- accept(null, WebSocketEcho);
-
- return Task.FromResult