Reacting to new Hosting API

This commit is contained in:
John Luo 2015-12-17 16:47:55 -08:00
parent 2dc31546b6
commit fdf0b84136
7 changed files with 57 additions and 58 deletions

View File

@ -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("</body></html>");
});
}
public static void Main(string[] args)
{
var application = new WebApplicationBuilder()
.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
.UseStartup<Startup>()
.Build();
application.Run();
}
}
}

View File

@ -0,0 +1,4 @@
{
"server": "Microsoft.AspNet.Server.WebListener",
"server.urls": "http://localhost:12345"
}

View File

@ -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": { }
}
}

View File

@ -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<Startup>()
.Build();
application.Run();
}
}
}

View File

@ -0,0 +1,4 @@
{
"server": "Microsoft.AspNet.Server.WebListener",
"server.urls": "http://localhost:8080"
}

View File

@ -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": { }
}
}

View File

@ -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 file="AuthenticationManager.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------
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);
}
}
}