From 38f70a02f73cd2b7553acfe9fc0391c616e8942d Mon Sep 17 00:00:00 2001 From: Chris R Date: Fri, 19 Jun 2015 12:14:13 -0700 Subject: [PATCH] #125 Add a Hosting dependency and Program.Main. --- samples/HotAddSample/project.json | 3 +- samples/SelfHostServer/project.json | 3 +- .../Program.cs | 45 +++++++++++++++++++ .../project.json | 4 +- .../project.json | 1 - 5 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 src/Microsoft.AspNet.Server.WebListener/Program.cs diff --git a/samples/HotAddSample/project.json b/samples/HotAddSample/project.json index cfc1678585..35533a5c39 100644 --- a/samples/HotAddSample/project.json +++ b/samples/HotAddSample/project.json @@ -1,12 +1,11 @@ { "version": "1.0.0-*", "dependencies": { - "Microsoft.AspNet.Hosting": "1.0.0-*", "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.Framework.Logging.Console": "1.0.0-*" }, "commands": { - "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:12345" + "web": "Microsoft.AspNet.Server.WebListener --server.urls http://localhost:12345" }, "frameworks" : { "dnx451" : { }, diff --git a/samples/SelfHostServer/project.json b/samples/SelfHostServer/project.json index d8a3b0a190..cf63300858 100644 --- a/samples/SelfHostServer/project.json +++ b/samples/SelfHostServer/project.json @@ -1,10 +1,9 @@ { "dependencies": { - "Microsoft.AspNet.Hosting": "1.0.0-*", "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.Framework.Logging.Console": "1.0.0-*" }, - "commands": { "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:8080" }, + "commands": { "web": "Microsoft.AspNet.Server.WebListener --server.urls http://localhost:8080" }, "frameworks": { "dnx451": { }, "dnxcore50": { } diff --git a/src/Microsoft.AspNet.Server.WebListener/Program.cs b/src/Microsoft.AspNet.Server.WebListener/Program.cs new file mode 100644 index 0000000000..ef795cbef0 --- /dev/null +++ b/src/Microsoft.AspNet.Server.WebListener/Program.cs @@ -0,0 +1,45 @@ +// 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 + { + private readonly IServiceProvider _serviceProvider; + + public Program(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + } + + public void Main(string[] args) + { + var program = new Hosting.Program(_serviceProvider); + var mergedArgs = new[] { "--server", "Microsoft.AspNet.Server.WebListener" }.Concat(args).ToArray(); + program.Main(mergedArgs); + } + } +} diff --git a/src/Microsoft.AspNet.Server.WebListener/project.json b/src/Microsoft.AspNet.Server.WebListener/project.json index 0e52987ecb..d2f2494450 100644 --- a/src/Microsoft.AspNet.Server.WebListener/project.json +++ b/src/Microsoft.AspNet.Server.WebListener/project.json @@ -2,9 +2,7 @@ "version": "1.0.0-*", "description": "ASP.NET 5 self-host web server.", "dependencies": { - "Microsoft.AspNet.Http.Features": "1.0.0-*", - "Microsoft.AspNet.Hosting.Server.Abstractions": "1.0.0-*", - "Microsoft.Framework.Logging.Abstractions": "1.0.0-*", + "Microsoft.AspNet.Hosting": "1.0.0-*", "Microsoft.Net.Http.Headers": "1.0.0-*", "Microsoft.Net.Http.Server": "1.0.0-*" }, diff --git a/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/project.json b/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/project.json index 310ae5d0f1..1edc19d889 100644 --- a/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/project.json +++ b/test/Microsoft.AspNet.Server.WebListener.FunctionalTests/project.json @@ -3,7 +3,6 @@ "test": "xunit.runner.aspnet" }, "dependencies": { - "Microsoft.AspNet.Http": "1.0.0-*", "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.AspNet.Testing": "1.0.0-*", "xunit.runner.aspnet": "2.0.0-aspnet-*"