From 99ad37fa99f97f726bc30651346bc53f787a5cd4 Mon Sep 17 00:00:00 2001 From: sornaks Date: Fri, 17 Oct 2014 13:42:31 -0700 Subject: [PATCH] Issue #1311: Samples should be able to run on Mono. Fix: Adding support for Kestrel server and fixing the paths for mono. --- samples/MvcSample.Web/Startup.cs | 4 +++- samples/MvcSample.Web/project.json | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/samples/MvcSample.Web/Startup.cs b/samples/MvcSample.Web/Startup.cs index 529cc9606f..c3b0c3708b 100644 --- a/samples/MvcSample.Web/Startup.cs +++ b/samples/MvcSample.Web/Startup.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using Microsoft.AspNet.Builder; using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.Razor; @@ -21,8 +22,9 @@ namespace MvcSample.Web { app.UseFileServer(); #if ASPNET50 + // We use Path.Combine here so that it works on platforms other than Windows as well. var configuration = new Configuration() - .AddJsonFile(@"App_Data\config.json") + .AddJsonFile(Path.Combine("App_Data", "config.json")) .AddEnvironmentVariables(); string diSystem; diff --git a/samples/MvcSample.Web/project.json b/samples/MvcSample.Web/project.json index ada8920f2c..d79e8587d7 100644 --- a/samples/MvcSample.Web/project.json +++ b/samples/MvcSample.Web/project.json @@ -3,6 +3,7 @@ "warningsAsErrors": true }, "dependencies": { + "Kestrel": "1.0.0-*", "Microsoft.AspNet.Mvc": "6.0.0-*", "Microsoft.AspNet.Server.IIS": "1.0.0-*", "Microsoft.AspNet.Server.WebListener": "1.0.0-*", @@ -10,7 +11,10 @@ "Microsoft.DataAnnotations": "1.0.0-*", "Microsoft.Framework.ConfigurationModel": "1.0.0-*" }, - "commands": { "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, + "commands": { + "web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001", + "kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5000" + }, "frameworks": { "aspnet50": { "dependencies": {