diff --git a/samples/HotAddSample/Startup.cs b/samples/HotAddSample/Startup.cs index c3e618e1df..6da3251b00 100644 --- a/samples/HotAddSample/Startup.cs +++ b/samples/HotAddSample/Startup.cs @@ -1,5 +1,6 @@ using System; using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.Server.Features; @@ -86,5 +87,15 @@ namespace HotAddSample await context.Response.WriteAsync(""); }); } + + public static void Main(string[] args) + { + var application = new WebApplicationBuilder() + .UseConfiguration(WebApplicationConfiguration.GetDefault(args)) + .UseStartup() + .Build(); + + application.Run(); + } } } diff --git a/samples/HotAddSample/hosting.json b/samples/HotAddSample/hosting.json new file mode 100644 index 0000000000..2efa8f78a3 --- /dev/null +++ b/samples/HotAddSample/hosting.json @@ -0,0 +1,4 @@ +{ + "server": "Microsoft.AspNet.Server.WebListener", + "server.urls": "http://localhost:12345" +} diff --git a/samples/HotAddSample/project.json b/samples/HotAddSample/project.json index ade404891b..4b5d9cf38d 100644 --- a/samples/HotAddSample/project.json +++ b/samples/HotAddSample/project.json @@ -1,14 +1,17 @@ { - "version": "1.0.0-*", - "dependencies": { - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.Extensions.Logging.Console": "1.0.0-*" - }, - "commands": { - "web": "Microsoft.AspNet.Server.WebListener --server.urls http://localhost:12345" - }, - "frameworks" : { - "dnx451" : { }, - "dnxcore50" : { } - } + "version": "1.0.0-*", + "dependencies": { + "Microsoft.AspNet.Server.WebListener": "1.0.0-*", + "Microsoft.Extensions.Logging.Console": "1.0.0-*" + }, + "compilationOptions": { + "emitEntryPoint": true + }, + "commands": { + "web": "HotAddSample" + }, + "frameworks": { + "dnx451": { }, + "dnxcore50": { } + } } diff --git a/samples/SelfHostServer/Startup.cs b/samples/SelfHostServer/Startup.cs index f9d7649562..377cc3eb63 100644 --- a/samples/SelfHostServer/Startup.cs +++ b/samples/SelfHostServer/Startup.cs @@ -3,6 +3,7 @@ using System.Net.WebSockets; using System.Text; using System.Threading; using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http; using Microsoft.AspNet.Http.Features; using Microsoft.Extensions.Logging; @@ -36,5 +37,15 @@ namespace SelfHostServer } }); } + + public static void Main(string[] args) + { + var application = new WebApplicationBuilder() + .UseConfiguration(WebApplicationConfiguration.GetDefault(args)) + .UseStartup() + .Build(); + + application.Run(); + } } } diff --git a/samples/SelfHostServer/hosting.json b/samples/SelfHostServer/hosting.json new file mode 100644 index 0000000000..6ac58d83c9 --- /dev/null +++ b/samples/SelfHostServer/hosting.json @@ -0,0 +1,4 @@ +{ + "server": "Microsoft.AspNet.Server.WebListener", + "server.urls": "http://localhost:8080" +} diff --git a/samples/SelfHostServer/project.json b/samples/SelfHostServer/project.json index ec72077179..d0e19d44c0 100644 --- a/samples/SelfHostServer/project.json +++ b/samples/SelfHostServer/project.json @@ -1,11 +1,14 @@ { - "dependencies": { - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", - "Microsoft.Extensions.Logging.Console": "1.0.0-*" - }, - "commands": { "web": "Microsoft.AspNet.Server.WebListener --server.urls http://localhost:8080" }, - "frameworks": { - "dnx451": { }, - "dnxcore50": { } - } + "dependencies": { + "Microsoft.AspNet.Server.WebListener": "1.0.0-*", + "Microsoft.Extensions.Logging.Console": "1.0.0-*" + }, + "compilationOptions": { + "emitEntryPoint": true + }, + "commands": { "web": "SelfHostServer" }, + "frameworks": { + "dnx451": { }, + "dnxcore50": { } + } } diff --git a/src/Microsoft.AspNet.Server.WebListener/Program.cs b/src/Microsoft.AspNet.Server.WebListener/Program.cs deleted file mode 100644 index a13e2ed125..0000000000 --- a/src/Microsoft.AspNet.Server.WebListener/Program.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. -// All Rights Reserved -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR -// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING -// WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF -// TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR -// NON-INFRINGEMENT. -// See the Apache 2 License for the specific language governing -// permissions and limitations under the License. - -// ----------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// ----------------------------------------------------------------------- - -using System; -using System.Linq; - -namespace Microsoft.AspNet.Server.WebListener -{ - public class Program - { - public static void Main(string[] args) - { - var mergedArgs = new[] { "--server", "Microsoft.AspNet.Server.WebListener" }.Concat(args).ToArray(); - Hosting.Program.Main(mergedArgs); - } - } -}