Add KestrelServerOptionsSetup before KestrelServerOptions (#755) (#757)

- Required to ensure that options.ApplicationServices is available after during UseKestrel(options)
This commit is contained in:
Mike Harder 2016-04-18 16:57:59 -07:00
parent bbf2c83a7d
commit 0453e4af70
2 changed files with 18 additions and 4 deletions

View File

@ -44,12 +44,10 @@ namespace Microsoft.AspNetCore.Hosting
/// </returns>
public static IWebHostBuilder UseKestrel(this IWebHostBuilder hostBuilder, Action<KestrelServerOptions> options)
{
hostBuilder.ConfigureServices(services =>
return hostBuilder.UseKestrel().ConfigureServices(services =>
{
services.Configure(options);
});
return hostBuilder.UseKestrel();
}
}
}

View File

@ -29,7 +29,23 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
});
// Act
var host = hostBuilder.Build();
hostBuilder.Build();
}
[Fact]
public void ApplicationServicesNotNullDuringUseKestrelWithOptions()
{
// Arrange
var hostBuilder = new WebHostBuilder()
.UseKestrel(options =>
{
// Assert
Assert.NotNull(options.ApplicationServices);
})
.Configure(app => { });
// Act
hostBuilder.Build();
}
}
}