diff --git a/README.md b/README.md index 7d2fb5a..065fb8a 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ This project is part of ASP.NET 5.0. You can find samples, documentation and get ## Run on WebListener/Kestrel: * Open a command prompt and cd `\src\MusicStore\`. * **[WebListener]:** - 4. Run `k WebListener` (Application started at URL **http://localhost:5002/**). + 4. Run `k web` (Application started at URL **http://localhost:5002/**). * **[Kestrel]:** - 5. Run `k Kestrel` (Application started at URL **http://localhost:5004/**). + 5. Run `k kestrel` (Application started at URL **http://localhost:5004/**). * **[CustomHost]:** 6. Run `k run` (This hosts the app in a console application - Application started at URL **http://localhost:5003/**). diff --git a/src/MusicStore/Areas/Admin/Controllers/StoreManagerController.cs b/src/MusicStore/Areas/Admin/Controllers/StoreManagerController.cs index d07ffca..f2b8220 100644 --- a/src/MusicStore/Areas/Admin/Controllers/StoreManagerController.cs +++ b/src/MusicStore/Areas/Admin/Controllers/StoreManagerController.cs @@ -51,7 +51,7 @@ namespace MusicStore.Areas.Admin.Controllers { var cacheKey = GetCacheKey(id); - var album = await _cache.GetOrSet(GetCacheKey(id), async context => + var album = await _cache.GetOrSet(cacheKey, async context => { //Remove it from cache if not retrieved in last 10 minutes. context.SetSlidingExpiration(TimeSpan.FromMinutes(10)); diff --git a/src/MusicStore/Mocks/MicrosoftAccount/MicrosoftAccountMockBackChannelHandler.cs b/src/MusicStore/Mocks/MicrosoftAccount/MicrosoftAccountMockBackChannelHandler.cs index 0de1e47..9d2f341 100644 --- a/src/MusicStore/Mocks/MicrosoftAccount/MicrosoftAccountMockBackChannelHandler.cs +++ b/src/MusicStore/Mocks/MicrosoftAccount/MicrosoftAccountMockBackChannelHandler.cs @@ -25,7 +25,6 @@ namespace MusicStore.Mocks.MicrosoftAccount if (formData["redirect_uri"] != null && formData["redirect_uri"].EndsWith("signin-microsoft") && formData["client_id"] == "[ClientId]" && formData["client_secret"] == "[ClientSecret]") { - System.Console.WriteLine("Handler2"); response.Content = new StringContent("{\"token_type\":\"bearer\",\"expires_in\":3600,\"scope\":\"wl.basic\",\"access_token\":\"ValidAccessToken\",\"refresh_token\":\"ValidRefreshToken\",\"authentication_token\":\"ValidAuthenticationToken\"}"); } } diff --git a/src/MusicStore/Mocks/StartupSocialTesting.cs b/src/MusicStore/Mocks/StartupSocialTesting.cs index e97b525..3a2980f 100644 --- a/src/MusicStore/Mocks/StartupSocialTesting.cs +++ b/src/MusicStore/Mocks/StartupSocialTesting.cs @@ -3,6 +3,7 @@ using System.IO; using System.Threading.Tasks; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Diagnostics; +using Microsoft.AspNet.Diagnostics.Entity; using Microsoft.AspNet.Http; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Routing; @@ -48,6 +49,8 @@ namespace MusicStore //Note: ErrorPageOptions.ShowAll to be used only at development time. Not recommended for production. app.UseErrorPage(ErrorPageOptions.ShowAll); + app.UseDatabaseErrorPage(DatabaseErrorPageOptions.ShowAll); + app.UseServices(services => { //Sql client not available on mono diff --git a/src/MusicStore/Mocks/Twitter/TwitterMockBackChannelHttpHandler.cs b/src/MusicStore/Mocks/Twitter/TwitterMockBackChannelHttpHandler.cs index a6ab9a9..0d38b92 100644 --- a/src/MusicStore/Mocks/Twitter/TwitterMockBackChannelHttpHandler.cs +++ b/src/MusicStore/Mocks/Twitter/TwitterMockBackChannelHttpHandler.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Threading; @@ -18,7 +17,6 @@ namespace MusicStore.Mocks.Twitter protected async override Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { var response = new HttpResponseMessage(); - Console.WriteLine(request.RequestUri.AbsoluteUri); if (request.RequestUri.AbsoluteUri.StartsWith("https://api.twitter.com/oauth/access_token")) { diff --git a/src/MusicStore/Startup.cs b/src/MusicStore/Startup.cs index f305832..7198537 100644 --- a/src/MusicStore/Startup.cs +++ b/src/MusicStore/Startup.cs @@ -1,6 +1,7 @@ using System; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Diagnostics; +using Microsoft.AspNet.Diagnostics.Entity; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Routing; using Microsoft.Framework.Cache.Memory; @@ -92,6 +93,8 @@ namespace MusicStore //During development use the ErrorPage middleware to display error information in the browser app.UseErrorPage(ErrorPageOptions.ShowAll); + app.UseDatabaseErrorPage(DatabaseErrorPageOptions.ShowAll); + // Add the runtime information page that can be used by developers // to see what packages are used by the application // default path is: /runtimeinfo diff --git a/src/MusicStore/StartupNtlmAuthentication.cs b/src/MusicStore/StartupNtlmAuthentication.cs index b689c8a..edb9010 100644 --- a/src/MusicStore/StartupNtlmAuthentication.cs +++ b/src/MusicStore/StartupNtlmAuthentication.cs @@ -3,6 +3,7 @@ using System.Security.Claims; using System.Security.Principal; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Diagnostics; +using Microsoft.AspNet.Diagnostics.Entity; using Microsoft.AspNet.Routing; using Microsoft.AspNet.Server.WebListener; using Microsoft.Framework.Cache.Memory; @@ -23,7 +24,7 @@ namespace MusicStore /// 1. Set the environment variable named SET ASPNET_ENV=NtlmAuthentication /// 2. For selfhost based servers pass in a command line variable named --env with this value. Eg: /// "commands": { - /// "WebListener": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5002 --ASPNET_ENV NtlmAuthentication", + /// "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5002 --ASPNET_ENV NtlmAuthentication", /// }, /// public class StartupNtlmAuthentication @@ -66,6 +67,8 @@ namespace MusicStore //Note: ErrorPageOptions.ShowAll to be used only at development time. Not recommended for production. app.UseErrorPage(ErrorPageOptions.ShowAll); + app.UseDatabaseErrorPage(DatabaseErrorPageOptions.ShowAll); + app.UseServices(services => { // Add EF services to the services container diff --git a/src/MusicStore/project.json b/src/MusicStore/project.json index 5284eff..e4df3da 100644 --- a/src/MusicStore/project.json +++ b/src/MusicStore/project.json @@ -12,6 +12,7 @@ "EntityFramework.InMemory": "7.0.0-*", //For Mono "Kestrel": "1.0.0-*", "Microsoft.AspNet.Diagnostics": "1.0.0-*", + "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-*", "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-*", "Microsoft.AspNet.Mvc": "6.0.0-*", "Microsoft.AspNet.Security.Cookies": "1.0.0-*", @@ -28,8 +29,8 @@ "Microsoft.Framework.OptionsModel": "1.0.0-*" }, "commands": { - "WebListener": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5002", - "Kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5004", + "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5002", + "kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5004", "run": "run server.urls=http://localhost:5003" }, "frameworks": { diff --git a/test/E2ETests/Common/DeploymentUtility.cs b/test/E2ETests/Common/DeploymentUtility.cs index 1bda976..690e7dc 100644 --- a/test/E2ETests/Common/DeploymentUtility.cs +++ b/test/E2ETests/Common/DeploymentUtility.cs @@ -252,10 +252,12 @@ namespace E2ETests { Console.WriteLine(string.Format("Executing klr.exe --appbase {0} \"Microsoft.Framework.ApplicationHost\" {1}", startParameters.ApplicationPath, startParameters.ServerType.ToString())); + var commandName = startParameters.ServerType == ServerType.WebListener ? "web" : "kestrel"; + var startInfo = new ProcessStartInfo { FileName = "klr.exe", - Arguments = string.Format("--appbase {0} \"Microsoft.Framework.ApplicationHost\" {1}", startParameters.ApplicationPath, startParameters.ServerType.ToString()), + Arguments = string.Format("--appbase {0} \"Microsoft.Framework.ApplicationHost\" {1}", startParameters.ApplicationPath, commandName), UseShellExecute = true, CreateNoWindow = true };