Merge branch 'release' into dev

This commit is contained in:
Mike Harder 2016-04-18 15:33:21 -07:00
commit 0d9dc1a205
2 changed files with 40 additions and 2 deletions

View File

@ -23,7 +23,11 @@ namespace Microsoft.AspNetCore.Hosting
/// </returns>
public static IWebHostBuilder UseKestrel(this IWebHostBuilder hostBuilder)
{
return hostBuilder.ConfigureServices(services => services.AddSingleton<IServer, KestrelServer>());
return hostBuilder.ConfigureServices(services =>
{
services.AddTransient<IConfigureOptions<KestrelServerOptions>, KestrelServerOptionsSetup>();
services.AddSingleton<IServer, KestrelServer>();
});
}
/// <summary>
@ -42,7 +46,6 @@ namespace Microsoft.AspNetCore.Hosting
{
hostBuilder.ConfigureServices(services =>
{
services.AddTransient<IConfigureOptions<KestrelServerOptions>, KestrelServerOptionsSetup>();
services.Configure(options);
});

View File

@ -0,0 +1,35 @@
// 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.Hosting;
using Microsoft.AspNetCore.Server.Kestrel;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
namespace Microsoft.AspNetCore.Server.KestrelTests
{
public class WebHostBuilderKestrelExtensionsTests
{
[Fact]
public void ApplicationServicesNotNullAfterUseKestrelWithoutOptions()
{
// Arrange
var hostBuilder = new WebHostBuilder()
.UseKestrel()
.Configure(app => { });
hostBuilder.ConfigureServices(services =>
{
services.Configure<KestrelServerOptions>(options =>
{
// Assert
Assert.NotNull(options.ApplicationServices);
});
});
// Act
var host = hostBuilder.Build();
}
}
}