Reacting to new Hosting API
This commit is contained in:
parent
9b9fd5ff00
commit
55d9e6ee4a
|
|
@ -1,31 +0,0 @@
|
|||
using System;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace MusicStore
|
||||
{
|
||||
/// <summary>
|
||||
/// This demonstrates how the application can be launched in a console application.
|
||||
/// "dnx run" command in the application folder will invoke this.
|
||||
/// </summary>
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
//Add command line configuration source to read command line parameters.
|
||||
var builder = new ConfigurationBuilder();
|
||||
builder.AddCommandLine(args);
|
||||
var config = builder.Build();
|
||||
|
||||
using (new WebHostBuilder(config)
|
||||
.UseServerFactory("Microsoft.AspNet.Server.WebListener")
|
||||
.Build()
|
||||
.Start())
|
||||
{
|
||||
Console.WriteLine("Started the server..");
|
||||
Console.WriteLine("Press any key to stop the server");
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Hosting;
|
||||
using Microsoft.AspNet.Identity.EntityFramework;
|
||||
using Microsoft.Data.Entity;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
|
@ -219,5 +220,15 @@ namespace MusicStore
|
|||
//Populates the MusicStore sample data
|
||||
SampleData.InitializeMusicStoreDatabaseAsync(app.ApplicationServices).Wait();
|
||||
}
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var application = new WebApplicationBuilder()
|
||||
.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
application.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"server": "Microsoft.AspNet.Server.Kestrel"
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
"description": "Music store application on ASP.NET 5",
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true,
|
||||
"warningsAsErrors": true,
|
||||
"define": [ "DEMO", "TESTING" ]
|
||||
},
|
||||
|
|
@ -12,7 +13,6 @@
|
|||
"../../shared/**/*.cs"
|
||||
],
|
||||
"publishExclude": "*.cmd",
|
||||
"webroot": "wwwroot",
|
||||
"dependencies": {
|
||||
"EntityFramework.InMemory": "7.0.0-*",
|
||||
"EntityFramework.MicrosoftSqlServer": "7.0.0-*",
|
||||
|
|
@ -39,11 +39,7 @@
|
|||
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0-*"
|
||||
},
|
||||
"commands": {
|
||||
"gen": "Microsoft.Extensions.CodeGeneration",
|
||||
"run": "run server.urls=http://localhost:5003",
|
||||
"web": "Microsoft.AspNet.Server.Kestrel",
|
||||
"kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5004",
|
||||
"weblistener": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5002"
|
||||
"web": "MusicStore"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": { },
|
||||
|
|
|
|||
Loading…
Reference in New Issue