Updated samples to use new hosting APIs

This commit is contained in:
David Fowler 2014-03-27 22:42:39 -07:00
parent a42fcb72b3
commit a18e037578
6 changed files with 17 additions and 101 deletions

View File

@ -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<Startup>(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
}
}
}

View File

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

View File

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

View File

@ -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<Startup>(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
}
}
}

View File

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

View File

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