From a18e0375784a2aa3b3cbe5c5505c885119482a04 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Thu, 27 Mar 2014 22:42:39 -0700 Subject: [PATCH] Updated samples to use new hosting APIs --- samples/ErrorPageSample/Program.cs | 28 -------------------------- samples/ErrorPageSample/Startup.cs | 17 ++++------------ samples/ErrorPageSample/project.json | 15 +++++--------- samples/WelcomePageSample/Program.cs | 28 -------------------------- samples/WelcomePageSample/Startup.cs | 15 +++----------- samples/WelcomePageSample/project.json | 15 +++++--------- 6 files changed, 17 insertions(+), 101 deletions(-) delete mode 100644 samples/ErrorPageSample/Program.cs delete mode 100644 samples/WelcomePageSample/Program.cs diff --git a/samples/ErrorPageSample/Program.cs b/samples/ErrorPageSample/Program.cs deleted file mode 100644 index a4c76acea0..0000000000 --- a/samples/ErrorPageSample/Program.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -#if NET45 -using System.Diagnostics; -using Microsoft.Owin.Hosting; -#endif - -namespace ErrorPageSample -{ - public class Program - { - const string baseUrl = "http://localhost:9001/"; - - public static void Main() - { -#if NET45 - using (WebApp.Start(new StartOptions(baseUrl))) - { - Console.WriteLine("Listening at {0}", baseUrl); - Process.Start(baseUrl); - Console.WriteLine("Press any key to exit"); - Console.ReadKey(); - } -#else - Console.WriteLine("Hello World"); -#endif - } - } -} \ No newline at end of file diff --git a/samples/ErrorPageSample/Startup.cs b/samples/ErrorPageSample/Startup.cs index d39eb7874c..bed1d3cc07 100644 --- a/samples/ErrorPageSample/Startup.cs +++ b/samples/ErrorPageSample/Startup.cs @@ -1,27 +1,18 @@ -#if NET45 -using System; +using System; using Microsoft.AspNet; using Microsoft.AspNet.Abstractions; -using Owin; namespace ErrorPageSample { public class Startup { - public void Configuration(IAppBuilder app) + public void Configuration(IBuilder app) { - // Temporary bridge from katana to Owin - app.UseBuilder(ConfigurePK); - } - - private void ConfigurePK(IBuilder builder) - { - builder.UseErrorPage(); - builder.Run(context => + app.UseErrorPage(); + app.Run(context => { throw new Exception("Demonstration exception"); }); } } } -#endif \ No newline at end of file diff --git a/samples/ErrorPageSample/project.json b/samples/ErrorPageSample/project.json index a10832478b..77f0f437b8 100644 --- a/samples/ErrorPageSample/project.json +++ b/samples/ErrorPageSample/project.json @@ -3,18 +3,13 @@ "dependencies": { "Microsoft.AspNet.Diagnostics": "", "Microsoft.AspNet.HttpFeature": "0.1-alpha-*", - "Microsoft.AspNet.Abstractions": "0.1-alpha-*" + "Microsoft.AspNet.Abstractions": "0.1-alpha-*", + "Microsoft.AspNet.Server.WebListener": "0.1-alpha-*", + "Microsoft.AspNet.Hosting": "0.1-alpha-*" }, + "commands": { "web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, "configurations": { - "net45": { - "dependencies": { - "Owin": "1.0", - "Microsoft.Owin": "2.1.0", - "Microsoft.Owin.Hosting": "2.1.0", - "Microsoft.Owin.Host.HttpListener": "2.1.0", - "Microsoft.AspNet.AppBuilderSupport": "0.1-alpha-*" - } - }, + "net45": {}, "k10": { "dependencies": { "System.Console": "4.0.0.0", diff --git a/samples/WelcomePageSample/Program.cs b/samples/WelcomePageSample/Program.cs deleted file mode 100644 index 0360e87f60..0000000000 --- a/samples/WelcomePageSample/Program.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -#if NET45 -using System.Diagnostics; -using Microsoft.Owin.Hosting; -#endif - -namespace WelcomePageSample -{ - public class Program - { - const string baseUrl = "http://localhost:9001/"; - - public static void Main() - { -#if NET45 - using (WebApp.Start(new StartOptions(baseUrl))) - { - Console.WriteLine("Listening at {0}", baseUrl); - Process.Start(baseUrl); - Console.WriteLine("Press any key to exit"); - Console.ReadKey(); - } -#else - Console.WriteLine("Hello World"); -#endif - } - } -} \ No newline at end of file diff --git a/samples/WelcomePageSample/Startup.cs b/samples/WelcomePageSample/Startup.cs index 0b08dfb71b..ca9ccc7148 100644 --- a/samples/WelcomePageSample/Startup.cs +++ b/samples/WelcomePageSample/Startup.cs @@ -1,22 +1,13 @@ -#if NET45 -using Microsoft.AspNet; +using Microsoft.AspNet; using Microsoft.AspNet.Abstractions; -using Owin; namespace WelcomePageSample { public class Startup { - public void Configuration(IAppBuilder app) + public void Configuration(IBuilder app) { - // Temporary bridge from katana to Owin - app.UseBuilder(ConfigurePK); - } - - private void ConfigurePK(IBuilder builder) - { - builder.UseWelcomePage(); + app.UseWelcomePage(); } } } -#endif \ No newline at end of file diff --git a/samples/WelcomePageSample/project.json b/samples/WelcomePageSample/project.json index a10832478b..c9932d4a4f 100644 --- a/samples/WelcomePageSample/project.json +++ b/samples/WelcomePageSample/project.json @@ -3,18 +3,13 @@ "dependencies": { "Microsoft.AspNet.Diagnostics": "", "Microsoft.AspNet.HttpFeature": "0.1-alpha-*", - "Microsoft.AspNet.Abstractions": "0.1-alpha-*" + "Microsoft.AspNet.Abstractions": "0.1-alpha-*", + "Microsoft.AspNet.Server.WebListener": "0.1-alpha-*", + "Microsoft.AspNet.Hosting": "0.1-alpha-*" }, + "commands": { "web": "Microsoft.AspNet.Hosting server.name=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001" }, "configurations": { - "net45": { - "dependencies": { - "Owin": "1.0", - "Microsoft.Owin": "2.1.0", - "Microsoft.Owin.Hosting": "2.1.0", - "Microsoft.Owin.Host.HttpListener": "2.1.0", - "Microsoft.AspNet.AppBuilderSupport": "0.1-alpha-*" - } - }, + "net45": { }, "k10": { "dependencies": { "System.Console": "4.0.0.0",