From cb4c05084b2eb3322a8f2c8b190050c57018d414 Mon Sep 17 00:00:00 2001 From: John Luo Date: Thu, 17 Dec 2015 21:21:15 -0800 Subject: [PATCH] Reacting to new Hosting API --- test/AutobahnTestServer/Project.json | 31 +++++++++---------- test/AutobahnTestServer/Startup.cs | 11 +++++++ test/AutobahnTestServer/hosting.json | 3 ++ .../KestrelWebSocketHelpers.cs | 7 +++-- 4 files changed, 33 insertions(+), 19 deletions(-) create mode 100644 test/AutobahnTestServer/hosting.json diff --git a/test/AutobahnTestServer/Project.json b/test/AutobahnTestServer/Project.json index 84d418c1db..ff0dac2eba 100644 --- a/test/AutobahnTestServer/Project.json +++ b/test/AutobahnTestServer/Project.json @@ -1,18 +1,17 @@ { - "webroot": "wwwroot", - "exclude": "wwwroot/**/*", - "dependencies": { - "Microsoft.AspNet.Server.IIS": "1.0.0-*", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.AspNet.WebSockets.Server": "1.0.0-*", - "Microsoft.AspNet.Server.Kestrel": "1.0.0-*" - }, - "commands": { - "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:12345", - "kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:12344" - }, - "frameworks" : { - "dnx451" : { }, - "dnxcore50" : { } - } + "exclude": "wwwroot/**/*", + "dependencies": { + "Microsoft.AspNet.WebSockets.Server": "1.0.0-*", + "Microsoft.AspNet.Server.Kestrel": "1.0.0-*" + }, + "compilationOptions": { + "emitEntryPoint": true + }, + "commands": { + "web": "AutobahnTestServer" + }, + "frameworks": { + "dnx451": { }, + "dnxcore50": { } + } } diff --git a/test/AutobahnTestServer/Startup.cs b/test/AutobahnTestServer/Startup.cs index bd69da7644..4ba3b887b7 100644 --- a/test/AutobahnTestServer/Startup.cs +++ b/test/AutobahnTestServer/Startup.cs @@ -6,6 +6,7 @@ using System.Net.WebSockets; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http; using Microsoft.AspNet.WebSockets.Server; @@ -69,5 +70,15 @@ namespace AutobahnTestServer } await webSocket.CloseAsync(result.CloseStatus.Value, result.CloseStatusDescription, CancellationToken.None); } + + public static void Main(string[] args) + { + var application = new WebApplicationBuilder() + .UseConfiguration(WebApplicationConfiguration.GetDefault(args)) + .UseStartup() + .Build(); + + application.Run(); + } } } diff --git a/test/AutobahnTestServer/hosting.json b/test/AutobahnTestServer/hosting.json new file mode 100644 index 0000000000..f8ef14574d --- /dev/null +++ b/test/AutobahnTestServer/hosting.json @@ -0,0 +1,3 @@ +{ + "server": "Microsoft.AspNet.Server.Kestrel" +} diff --git a/test/Microsoft.AspNet.WebSockets.Client.Test/KestrelWebSocketHelpers.cs b/test/Microsoft.AspNet.WebSockets.Client.Test/KestrelWebSocketHelpers.cs index d07e108c82..2b4edd2194 100644 --- a/test/Microsoft.AspNet.WebSockets.Client.Test/KestrelWebSocketHelpers.cs +++ b/test/Microsoft.AspNet.WebSockets.Client.Test/KestrelWebSocketHelpers.cs @@ -45,12 +45,13 @@ namespace Microsoft.AspNet.WebSockets.Client.Test var config = configBuilder.Build(); config["server.urls"] = "http://localhost:54321"; - var host = new WebHostBuilder(config) + var application = new WebApplicationBuilder() + .UseConfiguration(config) .UseServerFactory("Microsoft.AspNet.Server.Kestrel") - .UseStartup(startup) + .Configure(startup) .Build(); - return host.Start(); + return application.Start(); } } }