1. Removed some console logging statements from code
2. Used database error page like templates.
3. Renamed the command `WebListener` to `web` with all lower case to be consistent with templates.
4. Lowercased `Kestrel` => `kestrel` to be consistent with remaining samples.
This commit is contained in:
Praburaj 2014-12-30 13:16:08 -08:00
Родитель d9148bd6f7
Коммит e609602f2f
9 изменённых файлов: 20 добавлений и 11 удалений

Просмотреть файл

@ -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/**).

Просмотреть файл

@ -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));

Просмотреть файл

@ -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\"}");
}
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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<HttpResponseMessage> 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"))
{

Просмотреть файл

@ -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

Просмотреть файл

@ -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",
/// },
/// </summary>
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

Просмотреть файл

@ -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": {

Просмотреть файл

@ -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
};