diff --git a/build/common.props b/build/common.props
index dfd6c25f34..6a1fb41e41 100644
--- a/build/common.props
+++ b/build/common.props
@@ -6,6 +6,10 @@
Microsoft ASP.NET Core
https://github.com/aspnet/MetaPackages
git
+ false
+ ..\..\build\Key.snk
+ true
+ true
$(VersionSuffix)-$(BuildNumber)
@@ -20,7 +24,7 @@
-
+
@@ -28,6 +32,7 @@
+
@@ -102,7 +107,6 @@
-
diff --git a/samples/SampleApp/Program.cs b/samples/SampleApp/Program.cs
index e78eab19d1..30ba926b95 100644
--- a/samples/SampleApp/Program.cs
+++ b/samples/SampleApp/Program.cs
@@ -1,4 +1,7 @@
-using System;
+// 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;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@@ -10,54 +13,61 @@ namespace SampleApp
{
public static void Main(string[] args)
{
- //HelloWorld();
+ HelloWorld();
- //CustomUrl();
+ CustomUrl();
- Router();
+ CustomRouter();
- //StartupClass(args);
+ StartupClass(args);
}
private static void HelloWorld()
{
- var host = WebHost.Start(context => context.Response.WriteAsync("Hello, World!"));
- //host.WaitForShutdown(); // TODO: This method needs to be added to Hosting
- Console.WriteLine("Press any key to shutdown...");
- Console.ReadKey();
+ using (WebHost.Start(context => context.Response.WriteAsync("Hello, World!")))
+ {
+ //host.WaitForShutdown(); // TODO: https://github.com/aspnet/Hosting/issues/1022
+ Console.WriteLine("Running HelloWorld: Press any key to shutdown and start the next sample...");
+ Console.ReadKey();
+ }
}
private static void CustomUrl()
{
// Changing the listening URL
- var host = WebHost.Start("http://localhost:8080", context => context.Response.WriteAsync("Hello, World!"));
- //host.WaitForShutdown(); // TODO: This method needs to be added to Hosting
- Console.WriteLine("Press any key to shutdown...");
- Console.ReadKey();
+ using (WebHost.Start("http://localhost:8080", context => context.Response.WriteAsync("Hello, World!")))
+ {
+ //host.WaitForShutdown(); // TODO: https://github.com/aspnet/Hosting/issues/1022
+ Console.WriteLine("Running CustomUrl: Press any key to shutdown and start the next sample...");
+ Console.ReadKey();
+ }
}
- private static void Router()
+ private static void CustomRouter()
{
// Using a router
- var host = WebHost.Start(router => router
+ using (WebHost.Start(router => router
.MapGet("hello/{name}", (req, res, data) => res.WriteAsync($"Hello, {data.Values["name"]}"))
.MapGet("goodbye/{name}", (req, res, data) => res.WriteAsync($"Goodbye, {data.Values["name"]}"))
.MapGet("throw/{message?}", (req, res, data) => throw new Exception((string)data.Values["message"] ?? "Uh oh!"))
.MapGet("{greeting}/{name}", (req, res, data) => res.WriteAsync($"{data.Values["greeting"]}, {data.Values["name"]}"))
- .MapGet("", (req, res, data) => res.WriteAsync($"Hello, World!"))
- );
- //host.WaitForShutdown(); // TODO: This method needs to be added to Hosting
- Console.WriteLine("Press any key to shutdown...");
- Console.ReadKey();
+ .MapGet("", (req, res, data) => res.WriteAsync($"Hello, World!"))))
+ {
+ //host.WaitForShutdown(); // TODO: https://github.com/aspnet/Hosting/issues/1022
+ Console.WriteLine("Running CustomRouter: Press any key to shutdown and start the next sample...");
+ Console.ReadKey();
+ }
}
private static void StartupClass(string[] args)
{
// Using defaults with a Startup class
- var host = WebHost.CreateDefaultBuilder(args)
+ using (var host = WebHost.CreateDefaultBuilder(args)
.UseStartup()
- .Build();
- host.Run();
+ .Build())
+ {
+ host.Run();
+ }
}
}
}
diff --git a/samples/SampleApp/Startup.cs b/samples/SampleApp/Startup.cs
index 0f8e756160..287fffd27a 100644
--- a/samples/SampleApp/Startup.cs
+++ b/samples/SampleApp/Startup.cs
@@ -1,12 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
+// 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 Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
namespace SampleApp
{
@@ -16,7 +14,7 @@ namespace SampleApp
{
}
-
+
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.Run(async (context) =>
diff --git a/src/Microsoft.AspNetCore.All/Microsoft.AspNetCore.All.csproj b/src/Microsoft.AspNetCore.All/Microsoft.AspNetCore.All.csproj
index 3f4f051db9..a8f03f7ce0 100644
--- a/src/Microsoft.AspNetCore.All/Microsoft.AspNetCore.All.csproj
+++ b/src/Microsoft.AspNetCore.All/Microsoft.AspNetCore.All.csproj
@@ -7,7 +7,7 @@
netstandard1.6
aspnetcore
Microsoft.AspNetCore.All
- false
+ false
diff --git a/src/Microsoft.AspNetCore.RuntimeStore/Microsoft.AspNetCore.RuntimeStore.csproj b/src/Microsoft.AspNetCore.RuntimeStore/Microsoft.AspNetCore.RuntimeStore.csproj
index 6331331da8..23c1cf58ee 100644
--- a/src/Microsoft.AspNetCore.RuntimeStore/Microsoft.AspNetCore.RuntimeStore.csproj
+++ b/src/Microsoft.AspNetCore.RuntimeStore/Microsoft.AspNetCore.RuntimeStore.csproj
@@ -12,9 +12,9 @@
-
+
-
+
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore/Microsoft.AspNetCore.csproj b/src/Microsoft.AspNetCore/Microsoft.AspNetCore.csproj
index 1ce6696c7a..f63370faad 100644
--- a/src/Microsoft.AspNetCore/Microsoft.AspNetCore.csproj
+++ b/src/Microsoft.AspNetCore/Microsoft.AspNetCore.csproj
@@ -3,14 +3,11 @@
- true
netstandard1.5
aspnetcore
Microsoft.AspNetCore
- false
- ..\..\build\Key.snk
- true
- true
+ true
+ false
diff --git a/src/Microsoft.AspNetCore/WebHost.cs b/src/Microsoft.AspNetCore/WebHost.cs
index 4aa1a87df8..eca24f56b9 100644
--- a/src/Microsoft.AspNetCore/WebHost.cs
+++ b/src/Microsoft.AspNetCore/WebHost.cs
@@ -21,16 +21,16 @@ namespace Microsoft.AspNetCore
{
///
/// Initializes and starts a new with pre-configured defaults.
- /// See for details.
+ /// See for details.
///
/// A delegate that handles requests to the application.
/// A started that hosts the application.
public static IWebHost Start(RequestDelegate app) =>
- Start(null, app);
+ Start(url: null, app: app);
///
/// Initializes and starts a new with pre-configured defaults.
- /// See for details.
+ /// See for details.
///
/// The URL the hosted application will listen on.
/// A delegate that handles requests to the application.
@@ -40,16 +40,16 @@ namespace Microsoft.AspNetCore
///
/// Initializes and starts a new with pre-configured defaults.
- /// See for details.
+ /// See for details.
///
/// A delegate that configures the router for handling requests to the application.
/// A started that hosts the application.
public static IWebHost Start(Action routeBuilder) =>
- Start(null, routeBuilder);
+ Start(url: null, routeBuilder: routeBuilder);
///
/// Initializes and starts a new with pre-configured defaults.
- /// See for details.
+ /// See for details.
///
/// The URL the hosted application will listen on.
/// A delegate that configures the router for handling requests to the application.
@@ -59,22 +59,22 @@ namespace Microsoft.AspNetCore
///
/// Initializes and starts a new with pre-configured defaults.
- /// See for details.
+ /// See for details.
///
- /// A delegate that handles requests to the application.
+ /// The delegate that configures the .
/// A started that hosts the application.
public static IWebHost StartWith(Action app) =>
- StartWith(null, app);
+ StartWith(url: null, app: app);
///
/// Initializes and starts a new with pre-configured defaults.
- /// See for details.
+ /// See for details.
///
/// The URL the hosted application will listen on.
/// The delegate that configures the .
/// A started that hosts the application.
public static IWebHost StartWith(string url, Action app) =>
- StartWith(url, null, app);
+ StartWith(url: url, configureServices: null, app: app);
private static IWebHost StartWith(string url, Action configureServices, Action app)
{
@@ -115,7 +115,7 @@ namespace Microsoft.AspNetCore
///
/// The initialized .
public static IWebHostBuilder CreateDefaultBuilder() =>
- CreateDefaultBuilder(null);
+ CreateDefaultBuilder(args: null);
///
/// Initializes a new instance of the class with pre-configured defaults.
@@ -139,7 +139,7 @@ namespace Microsoft.AspNetCore
var builder = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
- .ConfigureConfiguration((hostingContext, config) =>
+ .ConfigureAppConfiguration((hostingContext, config) =>
{
var env = hostingContext.HostingEnvironment;
@@ -166,7 +166,6 @@ namespace Microsoft.AspNetCore
{
logging.AddConsole();
})
- // TODO: Remove this when ANCM injects it by default
.UseIISIntegration()
.ConfigureServices(services =>
{