Updated Program and Startup to new .NETCoreApp2.0 templates. Minor refactorings
This commit is contained in:
parent
116d5b55bb
commit
acefa64465
@ -1,4 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC
|
namespace Microsoft.eShopOnContainers.WebMVC
|
||||||
@ -7,15 +9,19 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = new WebHostBuilder()
|
BuildWebHost(args).Run();
|
||||||
.UseKestrel()
|
|
||||||
.UseHealthChecks("/hc")
|
|
||||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
|
||||||
.UseIISIntegration()
|
|
||||||
.UseStartup<Startup>()
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
host.Run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IWebHost BuildWebHost(string[] args) =>
|
||||||
|
WebHost.CreateDefaultBuilder(args)
|
||||||
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
|
.UseHealthChecks("/hc")
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.ConfigureLogging((hostingContext, builder) =>
|
||||||
|
{
|
||||||
|
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
|
||||||
|
builder.AddConsole();
|
||||||
|
builder.AddDebug();
|
||||||
|
}).Build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,17 +20,12 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public Startup(IHostingEnvironment env)
|
public Startup(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var builder = new ConfigurationBuilder()
|
Configuration = configuration;
|
||||||
.SetBasePath(env.ContentRootPath)
|
|
||||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) // Settings for the application
|
|
||||||
.AddEnvironmentVariables(); // override settings with environment variables set in compose.
|
|
||||||
|
|
||||||
Configuration = builder.Build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConfigurationRoot Configuration { get; }
|
public IConfiguration Configuration { get; }
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to add services to the container.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
@ -135,7 +130,8 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
|
|
||||||
var log = loggerFactory.CreateLogger("identity");
|
var log = loggerFactory.CreateLogger("identity");
|
||||||
WebContextSeed.Seed(app, env, loggerFactory);
|
|
||||||
|
WebContextSeed.Seed(app, env, loggerFactory);
|
||||||
|
|
||||||
app.UseMvc(routes =>
|
app.UseMvc(routes =>
|
||||||
{
|
{
|
||||||
|
@ -36,27 +36,8 @@
|
|||||||
</ItemGroup>-->
|
</ItemGroup>-->
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.0.0" />
|
<!--<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.1.4" />-->
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Session" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink.Loader" Version="14.1.0" />
|
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
|
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.1.4" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Options" Version="2.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
|
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
|
||||||
@ -66,8 +47,8 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.4.337" />
|
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.4.337" />
|
||||||
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0-msbuild3-final" />
|
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0" />
|
||||||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
|
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user