diff --git a/templates/AngularSpa/AngularSpa.csproj b/templates/AngularSpa/AngularSpa.csproj index b0cea30ff0..7e49bba2d2 100644 --- a/templates/AngularSpa/AngularSpa.csproj +++ b/templates/AngularSpa/AngularSpa.csproj @@ -1,23 +1,25 @@ - + + netcoreapp2.0 true - false + $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; - - - - - - - - - - + + + + + + + + + + + @@ -33,4 +35,5 @@ + \ No newline at end of file diff --git a/templates/AngularSpa/Controllers/HomeController.cs b/templates/AngularSpa/Controllers/HomeController.cs index 9d75da8823..2889abd920 100644 --- a/templates/AngularSpa/Controllers/HomeController.cs +++ b/templates/AngularSpa/Controllers/HomeController.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; @@ -15,6 +16,7 @@ namespace WebApplicationBasic.Controllers public IActionResult Error() { + ViewData["RequestId"] = Activity.Current?.Id ?? HttpContext.TraceIdentifier; return View(); } } diff --git a/templates/AngularSpa/Program.cs b/templates/AngularSpa/Program.cs index 193f1e2af4..e1e634e493 100644 --- a/templates/AngularSpa/Program.cs +++ b/templates/AngularSpa/Program.cs @@ -3,7 +3,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; namespace WebApplicationBasic { @@ -11,14 +14,12 @@ namespace WebApplicationBasic { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIISIntegration() + BuildWebHost(args).Run(); + } + + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) .UseStartup() .Build(); - - host.Run(); - } } } diff --git a/templates/AngularSpa/Startup.cs b/templates/AngularSpa/Startup.cs index e5d73ed6f0..d381113d09 100644 --- a/templates/AngularSpa/Startup.cs +++ b/templates/AngularSpa/Startup.cs @@ -7,41 +7,32 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.SpaServices.Webpack; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; namespace WebApplicationBasic { public class Startup { - public Startup(IHostingEnvironment env) + public Startup(IConfiguration configuration) { - var builder = new ConfigurationBuilder() - .SetBasePath(env.ContentRootPath) - .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) - .AddEnvironmentVariables(); - Configuration = builder.Build(); + Configuration = configuration; } - public IConfigurationRoot Configuration { get; } + public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - // Add framework services. services.AddMvc(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + public void Configure(IApplicationBuilder app, IHostingEnvironment env) { - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); - app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions { + app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions + { HotModuleReplacement = true }); } diff --git a/templates/AngularSpa/Views/Shared/Error.cshtml b/templates/AngularSpa/Views/Shared/Error.cshtml index 473b35d6ca..78e35d5d3c 100644 --- a/templates/AngularSpa/Views/Shared/Error.cshtml +++ b/templates/AngularSpa/Views/Shared/Error.cshtml @@ -4,3 +4,18 @@

Error.

An error occurred while processing your request.

+ +@if (!string.IsNullOrEmpty((string)ViewData["RequestId"])) +{ +

+ Request ID: @ViewData["RequestId"] +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. +

diff --git a/templates/AngularSpa/Views/Shared/_Layout.cshtml b/templates/AngularSpa/Views/Shared/_Layout.cshtml index 799964fa42..d5b7a0f598 100644 --- a/templates/AngularSpa/Views/Shared/_Layout.cshtml +++ b/templates/AngularSpa/Views/Shared/_Layout.cshtml @@ -1,15 +1,16 @@ - - - - @ViewData["Title"] - WebApplicationBasic - - - - - @RenderBody() + + + + @ViewData["Title"] - WebApplicationBasic + - @RenderSection("scripts", required: false) - + + + + @RenderBody() + + @RenderSection("scripts", required: false) + diff --git a/templates/AngularSpa/Views/_ViewImports.cshtml b/templates/AngularSpa/Views/_ViewImports.cshtml index e7b4f83fd1..8edbc68c0b 100644 --- a/templates/AngularSpa/Views/_ViewImports.cshtml +++ b/templates/AngularSpa/Views/_ViewImports.cshtml @@ -1,3 +1,3 @@ @using WebApplicationBasic -@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers" -@addTagHelper "*, Microsoft.AspNetCore.SpaServices" +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@addTagHelper *, Microsoft.AspNetCore.SpaServices diff --git a/templates/AngularSpa/appsettings.Development.json b/templates/AngularSpa/appsettings.Development.json new file mode 100644 index 0000000000..457e003321 --- /dev/null +++ b/templates/AngularSpa/appsettings.Development.json @@ -0,0 +1,19 @@ +{ + "Logging": { + "IncludeScopes": false, + "Debug": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + }, + "Console": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } + } +} diff --git a/templates/AngularSpa/appsettings.json b/templates/AngularSpa/appsettings.json index 723c096a87..c851e129f9 100644 --- a/templates/AngularSpa/appsettings.json +++ b/templates/AngularSpa/appsettings.json @@ -1,10 +1,15 @@ { "Logging": { "IncludeScopes": false, - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" + "Debug": { + "LogLevel": { + "Default": "Warning" + } + }, + "Console": { + "LogLevel": { + "Default": "Warning" + } } } } diff --git a/templates/AngularSpa/web.config b/templates/AngularSpa/web.config deleted file mode 100644 index a8d6672758..0000000000 --- a/templates/AngularSpa/web.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff --git a/templates/AureliaSpa/AureliaSpa.csproj b/templates/AureliaSpa/AureliaSpa.csproj index 11c64e1b2d..83fa7d3219 100644 --- a/templates/AureliaSpa/AureliaSpa.csproj +++ b/templates/AureliaSpa/AureliaSpa.csproj @@ -1,20 +1,20 @@ - + + netcoreapp2.0 true - false + $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; + - - + - - + - - + + @@ -30,4 +30,5 @@ + \ No newline at end of file diff --git a/templates/AureliaSpa/ClientApp/app/components/navmenu/navmenu.html b/templates/AureliaSpa/ClientApp/app/components/navmenu/navmenu.html index 38b97f9cf3..a604b7e862 100644 --- a/templates/AureliaSpa/ClientApp/app/components/navmenu/navmenu.html +++ b/templates/AureliaSpa/ClientApp/app/components/navmenu/navmenu.html @@ -9,7 +9,7 @@ - Aurelia + WebApplicationBasic