OWIN 的 Hello World
使用数据包管理器安装 Microsoft.Owin.SelfHost
install-packet Microsoft.Owin.SelfHost
从控制台窗口运行的最低 HelloWorld Web 应用程序的代码:
namespace HelloOwin
{
using System;
using Owin;
class Program
{
static readonly string baseUrl = "http://localhost:8080";
static void Main(string[] args)
{
using (Microsoft.Owin.Hosting.WebApp.Start<Startup>(baseUrl))
{
Console.WriteLine("Prease any key to quit.");
Console.ReadKey();
}
}
}
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.Run(ctx =>
{
return ctx.Response.WriteAsync("Hello World");
});
}
}
}