Add UseKestrel() extension method to IWebHostBuilder (#713)

This commit is contained in:
Mike Harder 2016-03-30 12:08:32 -07:00
parent aa17125f9e
commit 088b7e5779
10 changed files with 31 additions and 19 deletions

View File

@ -41,6 +41,8 @@ namespace LargeResponseApp
{
var host = new WebHostBuilder()
.UseDefaultHostingConfiguration(args)
.UseKestrel()
.UseUrls("http://localhost:5001/")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();

View File

@ -1,4 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel",
"server.urls": "http://localhost:5001/"
}

View File

@ -63,6 +63,8 @@ namespace SampleApp
{
var host = new WebHostBuilder()
.UseDefaultHostingConfiguration(args)
.UseKestrel()
.UseUrls("http://localhost:5000", "https://localhost:5001")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();

View File

@ -1,4 +0,0 @@
{
"server": "Microsoft.AspNetCore.Server.Kestrel",
"server.urls": "http://localhost:5000;https://localhost:5001"
}

View File

@ -0,0 +1,16 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using Microsoft.AspNetCore.Server.Kestrel;
namespace Microsoft.AspNetCore.Hosting
{
public static class KestrelWebHostBuilderExtensions
{
public static IWebHostBuilder UseKestrel(this IWebHostBuilder hostBuilder)
{
return hostBuilder.UseServer(typeof(KestrelServer).GetTypeInfo().Assembly.FullName);
}
}
}

View File

@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
var hostBuilder = new WebHostBuilder()
.UseConfiguration(config)
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseKestrel()
.Configure(ConfigureEchoAddress);
using (var host = hostBuilder.Build())

View File

@ -76,7 +76,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
var builder = new WebHostBuilder()
.UseConfiguration(config)
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseKestrel()
.Configure(app =>
{
app.Run(async context =>

View File

@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
{
var port = PortManager.GetPort();
var builder = new WebHostBuilder()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseKestrel()
.UseUrls($"http://localhost:{port}/")
.Configure(app =>
{
@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
{
var port = PortManager.GetPort();
var builder = new WebHostBuilder()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseKestrel()
.UseUrls($"http://localhost:{port}/")
.Configure(app =>
{
@ -139,7 +139,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
{
var port = PortManager.GetPort();
var builder = new WebHostBuilder()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseKestrel()
.UseUrls($"http://localhost:{port}")
.Configure(app =>
{
@ -168,7 +168,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
{
var port = PortManager.GetPort();
var builder = new WebHostBuilder()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseKestrel()
.UseUrls($"http://localhost:{port}/\u0041\u030A")
.Configure(app =>
{
@ -212,7 +212,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
{
var port = PortManager.GetPort();
var builder = new WebHostBuilder()
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseKestrel()
.UseUrls($"http://{registerAddress}:{port}")
.Configure(app =>
{

View File

@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
var hostBuilder = new WebHostBuilder()
.UseConfiguration(config)
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseKestrel()
.Configure(app =>
{
app.Run(async context =>
@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
var hostBuilder = new WebHostBuilder()
.UseConfiguration(config)
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseKestrel()
.Configure(app =>
{
app.Run(async context =>
@ -142,7 +142,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
var hostBuilder = new WebHostBuilder()
.UseConfiguration(config)
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseKestrel()
.Configure(app =>
{
app.Run(context =>

View File

@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
var hostBuilder = new WebHostBuilder()
.UseConfiguration(config)
.UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseKestrel()
.Configure(app =>
{
var serverInfo = app.ServerFeatures.Get<IKestrelServerInformation>();