- 命名约定
Katana在程序集内的程序集名称空间下查找一个叫做Startup的类,
- 通过属性指定
[assembly: OwinStartup(typeof(OwinConsoleApp.Startup))]
- 通过配置文件
<add key="owin:appStartup" value="OwinConsoleApp.Startup1" />
定义友好命名的Startup类
<appSettings> <add key="owin:appStartup" value="ProductionConfiguration" /> </appSettings>
[assembly: OwinStartup("ProductionConfiguration", typeof(StartupDemo.ProductionStartup2))] namespace StartupDemo { public class ProductionStartup { public void Configuration(IAppBuilder app) { app.Run(context => { string t = DateTime.Now.Millisecond.ToString(); return context.Response.WriteAsync(t + " Production OWIN App"); }); } } public class ProductionStartup2 { public void Configuration(IAppBuilder app) { app.Run(context => { string t = DateTime.Now.Millisecond.ToString(); return context.Response.WriteAsync(t + " 2nd Production OWIN App"); }); } } }
https://docs.microsoft.com/en-us/aspnet/aspnet/overview/owin-and-katana/owin-startup-class-detection