React to WebHostBuilder

This commit is contained in:
Hao Kung 2015-04-15 12:30:37 -07:00
parent cedfd88254
commit 69d42502a6
1 changed files with 9 additions and 1 deletions

View File

@ -11,14 +11,22 @@ namespace MusicStore
/// </summary> /// </summary>
public class Program public class Program
{ {
private readonly IServiceProvider _serviceProvider;
public Program(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public Task<int> Main(string[] args) public Task<int> Main(string[] args)
{ {
//Add command line configuration source to read command line parameters. //Add command line configuration source to read command line parameters.
var config = new Configuration(); var config = new Configuration();
config.AddCommandLine(args); config.AddCommandLine(args);
using (WebHost.CreateEngine(config) using (new WebHostBuilder(_serviceProvider, config)
.UseServer("Microsoft.AspNet.Server.WebListener") .UseServer("Microsoft.AspNet.Server.WebListener")
.Build()
.Start()) .Start())
{ {
Console.WriteLine("Started the server.."); Console.WriteLine("Started the server..");