diff --git a/samples/LargeResponseApp/Startup.cs b/samples/LargeResponseApp/Startup.cs index a45f95e715..6408c0bd61 100644 --- a/samples/LargeResponseApp/Startup.cs +++ b/samples/LargeResponseApp/Startup.cs @@ -41,6 +41,8 @@ namespace LargeResponseApp { var host = new WebHostBuilder() .UseDefaultHostingConfiguration(args) + .UseKestrel() + .UseUrls("http://localhost:5001/") .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup() .Build(); diff --git a/samples/LargeResponseApp/hosting.json b/samples/LargeResponseApp/hosting.json deleted file mode 100644 index 72788f30a9..0000000000 --- a/samples/LargeResponseApp/hosting.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel", - "server.urls": "http://localhost:5001/" -} \ No newline at end of file diff --git a/samples/SampleApp/Startup.cs b/samples/SampleApp/Startup.cs index b7735816d6..1590a8dac3 100644 --- a/samples/SampleApp/Startup.cs +++ b/samples/SampleApp/Startup.cs @@ -63,6 +63,8 @@ namespace SampleApp { var host = new WebHostBuilder() .UseDefaultHostingConfiguration(args) + .UseKestrel() + .UseUrls("http://localhost:5000", "https://localhost:5001") .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup() .Build(); diff --git a/samples/SampleApp/hosting.json b/samples/SampleApp/hosting.json deleted file mode 100644 index 5d7efdc792..0000000000 --- a/samples/SampleApp/hosting.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "server": "Microsoft.AspNetCore.Server.Kestrel", - "server.urls": "http://localhost:5000;https://localhost:5001" -} diff --git a/src/Microsoft.AspNetCore.Server.Kestrel/KestrelWebHostBuilderExtensions.cs b/src/Microsoft.AspNetCore.Server.Kestrel/KestrelWebHostBuilderExtensions.cs new file mode 100644 index 0000000000..aa6115094e --- /dev/null +++ b/src/Microsoft.AspNetCore.Server.Kestrel/KestrelWebHostBuilderExtensions.cs @@ -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); + } + } +} diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/AddressRegistrationTests.cs b/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/AddressRegistrationTests.cs index 6a65cb71f9..2422eb527f 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/AddressRegistrationTests.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/AddressRegistrationTests.cs @@ -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()) diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/PathBaseTests.cs b/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/PathBaseTests.cs index 3576bd4d8d..12baa2731d 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/PathBaseTests.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/PathBaseTests.cs @@ -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 => diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/RequestTests.cs b/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/RequestTests.cs index db7a6800f2..63f4415042 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/RequestTests.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/RequestTests.cs @@ -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 => { diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/ResponseTests.cs b/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/ResponseTests.cs index a6e39a3905..a1dfe66ab1 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/ResponseTests.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/ResponseTests.cs @@ -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 => diff --git a/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/ThreadCountTests.cs b/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/ThreadCountTests.cs index 437bcbe66c..fff6fb4497 100644 --- a/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/ThreadCountTests.cs +++ b/test/Microsoft.AspNetCore.Server.Kestrel.FunctionalTests/ThreadCountTests.cs @@ -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();