- Required to ensure that options.ApplicationServices is available after during UseKestrel(options)
This commit is contained in:
parent
bbf2c83a7d
commit
0453e4af70
|
|
@ -44,12 +44,10 @@ namespace Microsoft.AspNetCore.Hosting
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public static IWebHostBuilder UseKestrel(this IWebHostBuilder hostBuilder, Action<KestrelServerOptions> options)
|
public static IWebHostBuilder UseKestrel(this IWebHostBuilder hostBuilder, Action<KestrelServerOptions> options)
|
||||||
{
|
{
|
||||||
hostBuilder.ConfigureServices(services =>
|
return hostBuilder.UseKestrel().ConfigureServices(services =>
|
||||||
{
|
{
|
||||||
services.Configure(options);
|
services.Configure(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
return hostBuilder.UseKestrel();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,23 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
|
||||||
});
|
});
|
||||||
|
|
||||||
// Act
|
// 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue