Reacting to Hosting changes

This commit is contained in:
John Luo 2016-03-22 11:47:08 -07:00
parent a1f32e5651
commit c43fb71cff
3 changed files with 4 additions and 2 deletions

View File

@ -75,7 +75,7 @@ namespace IISSample
public static void Main(string[] args) public static void Main(string[] args)
{ {
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultHostingConfiguration(args)
.UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseServer("Microsoft.AspNetCore.Server.Kestrel")
.UseIIS() .UseIIS()
.UseStartup<Startup>() .UseStartup<Startup>()

View File

@ -18,6 +18,7 @@ namespace Microsoft.AspNetCore.Hosting
/// <summary> /// <summary>
/// Configures the port and base path the server should listen on when running behind AspNetCoreModule. /// Configures the port and base path the server should listen on when running behind AspNetCoreModule.
/// The app will also be configured to capture startup errors.
/// </summary> /// </summary>
/// <param name="app"></param> /// <param name="app"></param>
/// <returns></returns> /// <returns></returns>
@ -36,6 +37,7 @@ namespace Microsoft.AspNetCore.Hosting
{ {
var address = "http://localhost:" + port + path; var address = "http://localhost:" + port + path;
app.UseSetting(WebHostDefaults.ServerUrlsKey, address); app.UseSetting(WebHostDefaults.ServerUrlsKey, address);
app.CaptureStartupErrors(true);
app.ConfigureServices(services => app.ConfigureServices(services =>
{ {

View File

@ -10,7 +10,7 @@ namespace TestSites
public static void Main(string[] args) public static void Main(string[] args)
{ {
var host = new WebHostBuilder() var host = new WebHostBuilder()
.UseDefaultConfiguration(args) .UseDefaultHostingConfiguration(args)
.UseIIS() .UseIIS()
.UseStartup("TestSites") .UseStartup("TestSites")
.UseServer("Microsoft.AspNetCore.Server.Kestrel") .UseServer("Microsoft.AspNetCore.Server.Kestrel")