Add UseKestrel() extension method to IWebHostBuilder (#713)
This commit is contained in:
parent
aa17125f9e
commit
088b7e5779
|
|
@ -41,6 +41,8 @@ namespace LargeResponseApp
|
|||
{
|
||||
var host = new WebHostBuilder()
|
||||
.UseDefaultHostingConfiguration(args)
|
||||
.UseKestrel()
|
||||
.UseUrls("http://localhost:5001/")
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel",
|
||||
"server.urls": "http://localhost:5001/"
|
||||
}
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"server": "Microsoft.AspNetCore.Server.Kestrel",
|
||||
"server.urls": "http://localhost:5000;https://localhost:5001"
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -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 =>
|
||||
|
|
|
|||
|
|
@ -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 =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 =>
|
||||
|
|
|
|||
|
|
@ -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>();
|
||||
|
|
|
|||
Loading…
Reference in New Issue